help with VB script

Techy Geek

Daemon Poster
Messages
1,320
Hi,
Im making a website with a password login thingy, heres the code I've got so far:

Code:
Sub Button1_onclick
	if  = "password" then msgbox "hello"
	else msgbox "get it right"
End Sub


I want it to retrieve the text that has been put into the password text box and make this a "pass" variable. Hopefully I could then use the if... statement (as you see above) to see if the correct password has been entered).Any ideas how to do this.

I would also like it to go to a specific web address if the password is correct

thanks in advance
 

root

Site Team
Staff member
Messages
8,181
Location
UK
VBscript is a very bad way of making passwird protected websites.

there are also other problems,

1, some web browsers don't understand VB script, (some refuse to use VB script as this is a microsoft technology, (this includes all Linux Users).

2, VB script is unsecure. you'll have to declare the password in the script to have it checked, the password will have to be in plain text somewhere in the document, OR, you'll have to work out sme sort of encrpytion, but it's going to have to be declared in the script, and reversible throughout the script.

You'd be much beter advised to use Java, (not javascript), ASP, PHP, PERL or some other web language,
Have a think about what I've said, and I'll help you with whatever you'd like to use as the final solution.
 

Techy Geek

Daemon Poster
Messages
1,320
ok, thanks for that, I'll take you up on that, would you know how to do this in Java, it's easier for me to use VBscript, as I already know VB and the two are very similar. However, I dont have the time to learn Java just for 1 site, could anyone help me with coding it in java.
 

root

Site Team
Staff member
Messages
8,181
Location
UK
Writing in javascript is just as bad for this...

consider this code sample

Code:
<html>
<script>
var password="asecret";
function checkpassword()
{
 var pass=document.logon.passbox.value;
 if (pass == password)
 {
  document.location = "www.enter.com";
 }
 else
 {
  document.location = "www.deny.com";
 }
}
</script>
<form name=logon>
<input type="text" name="passbox" />
<img src="submit.gif" onclick="checkpassword();">
</form>
</html>
That Javascript does exactly what you want, but it's still just as insecure as if you did it in VB script...

The best route is still PHP/ASP

if you already nkow VB script, then I suggest ASP will have an easier learning curve as it's vaguely simillar in a lot of respects... the biggest difference of course is that unless something has a print to page type statement before it it cannot be seen, thus making your password secure...
 

Techy Geek

Daemon Poster
Messages
1,320
thats great, except one thing, I need a username thing as well, rather like the one that we have on CF, but with only like 5 usernames and their different passwords, there is no real need for a database, as there will be few members (less than 5) so it could be contained within the code: could anyone help me with that.

I wouldnt bother about security, its only so people can see a few pictures (its for a photography website I'm designing for my dad)
 

jetway

Solid State Member
Messages
9
I would strongly recommend php for this application. I'm sure there are people in this forum that are willing to help you code it.
 

Techy Geek

Daemon Poster
Messages
1,320
oh, ok, I dont care what language its in, but can anyone help me code this. Many thanks in advance, it is really important I get this done
 

root

Site Team
Staff member
Messages
8,181
Location
UK
Do you know what webserver you have and whether you are allowde to set up protected areas?

That wuold most likely be the best solution to the poblem here, both secure, and working with minimum effort...
 

Techy Geek

Daemon Poster
Messages
1,320
at present my host is www.1asphost.com its the free account. I will soon be upgrading to another host, as I need hosting without popups and messages (i'm using that one merely to test the site as it may take me some time to complete the site) the truth is: I dont know. I wouldnt have thought so.

As I have said before, it doesnt need to be that secure, as it is for a photography website, allowing clients to log in and see their photos before ordering, I'm sure that hackers aren't that bothered about seeing a few photos, there isnt any personal information that they can know from that.

My only problem with the code you origionally gave me is that I need to have several usernames as well, it was great, I have used that code, but would like to have usernames as well
 
Top