Jump to content
Mcjohnes

need help with a simple single field javascript login form

Recommended Posts

hello i need help with a simple javascript simple login form, i am building a small website for I and my classmates. i want it to be able to redirect each user to a specific page when a corresponding passcode is entered, i know its unsafe but we dont plan on keeping valuable information on the site, i dont know about MSQL and dont even wish to use it, the code works at this level but am unable to add users since i dont understand javascript if someone could help me i will be very grateful
thanks in advance
/*here is the code i got so far*/<tittle>Enter Passcode to proceed</title><h1 style="font-family:Comic Sans Ms;text-align="center";font-size:20pt;color:#00FF00;></h1><form name="login">Passcode: <input type="text" name="userid"/><input type="button" onclick="check(this.form)" value="Login"/><input type="reset" value="Cancel"/></form><script type="text/javascript">function check(form)/*function to check userid */{ /*the following code checkes whether the entered userid is correct*/ if(form.userid.value == "JohnDoe") {    window.open("johndoe.php")/*opens the target page while Id */  } else {   alert("Invalid Passcode, please try again!")/*displays error message*/  }}</script>

 

Share this post


Link to post
Share on other sites

It's not just "unsafe", it provides absolutely zero security, honestly. For what it's worth you might as well have a list of links to each corresponding page and ask them politely not to visit pages that don't correspond to them.

  • Like 1

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...

×
×
  • Create New...