Click to See Complete Forum and Search --> : Help with javascript


NigelJHatcher
08-20-2003, 07:32 PM
I am working on a javascript for a password verification entry on my site. So far I have only been able to get it to work with a single username and password but would like to have a database to pull from and have multiple users and passwords. I will paste below what i have so far and see if anyone can suggest anything.

<form>
<p>ENTER USER NAME :
<input type="text" name="text2">
</p>
<p> ENTER PASSWORD :
<input type="password" name="text1">
<input type="button" value="Enter" name="Submit" onclick=javascript:validate(text2.value,"Username",text1.value,"Password")>
</p>

</form>
<script language = "javascript">

function validate(text1,text2,text3,text4)
{
if (text1==text2 && text3==text4)
load('http://mysite.com');
else
{
load('http://mysite.com');
}
}
function load(url)
{
location.href=url;
}
</script>

Exuro
08-20-2003, 08:29 PM
Verifying usernames and passwords really should be done server-side. If the user can simply look at the source code and view the valid options, there isn't much of a point in having one is there? Also, if the user is one of that 13% that doesn't have JavaScript enabled, then they're not even going to be able to access the page.