Page 1 of 1

Adding a username and password

Posted: Sun Jan 10, 2010 12:28 pm
by DreadNought
Hello everyone,
This can also be found in the Javascript section as this does contain some javascriptviewtopic.php?f=88&t=941

I just wonna make 1 thing clear before we start the tourtrial. This code CAN be broken by hackers, you should also know that HTML is NOT secure so if you want a secure username/password try a .htaccess or a PHP but anyway I will show you how to do this anyway here is the code,
Code: Select all
<script language="javascript">
function pasuser(form) {
if (form.id.value=="USERNAME") { 
if (form.pass.value=="PASSWORD") {              
location="SUCCESS.html" 
} else {
alert("Invalid Password")
}
} else {  alert("Invalid UserID")
}
}
//-->
</script>

<center>
<table bgcolor="white" cellpadding="12" border="1">
<tr><td colspan="2"><center><h1><i><b>Login
Area</b></i></h1></center></td></tr>
<tr><td><h1><i><b>UserID:</b></i></h1></td><td><form name="login"><input
name="id" type="text"></td></tr>
<tr><td><h1><i><b>Password:</b></i></h1></td><td><input name="pass"
type="password"></td></tr>
<tr><td><center><input type="button" value="Login"
onClick="pasuser(this.form)"></center></td><td><center><br><input
type="Reset"></form></td></tr></table></center> 
First, find the line's
Code: Select all
if (form.id.value=="USERNAME") { 
if (form.pass.value=="PASSWORD") { 
and edit were it ses USERNAME to the username you want people to use in order to access the website and change were it ses PASSWORD to the password you want people to use in order to access the passworded page

Second, Find the line
Code: Select all
location="SUCCESS.html" 
change SUCCESS to the page you want people to go to if the username and password is correct,

Tah Dah, all done

goto http://www.crazygaming.x10hosting.com/logintest.html and the username and password is
Username: codenstuff
Password: paralyzer

That is my website so,

Have fun with your login script

Re: Adding a username and password

Posted: Thu Feb 04, 2010 4:09 pm
by Manitara
All your HTML tutorials demo's no longer exist.. Website down?

Re: Adding a username and password

Posted: Fri Feb 05, 2010 12:19 am
by Lewis
You wont realy need a demo :P Put it on your computer it will work :P

Re: Adding a username and password

Posted: Fri Feb 05, 2010 6:02 pm
by DreadNought
Sorry, I didn't know that my website has ever been down but it is all up and working now.

Re: Adding a username and password

Posted: Wed Mar 03, 2010 4:45 am
by Livengood
Very nice Tutorial :D

Re: Adding a username and password

Posted: Mon Mar 15, 2010 1:06 pm
by 35000vr
Nice one!

Re: Adding a username and password

Posted: Tue Mar 23, 2010 7:05 pm
by DreadNought
Very sorry the link does not work anymore. Try it!