Click to See Complete Forum and Search --> : login script
cakeday
07-29-2003, 02:36 PM
does anyone have any good login/password script.. including the logout, if possible..
i would like it if, it pulls the login and passwords from the database, if not that is okay too..
this is very urgent. have a deadline to meet..
thank you very much..
Jupac
07-29-2003, 08:19 PM
WARNING!!! This is not secure
<html>
<head>
<script>
//shoud put in to a .js file
function Login(){
var done=0;
var username=document.login.username.value;
username=username.toLowerCase();
var password=document.login.password.value;
password=password.toLowerCase();
if (username=="me1" && password=="me1"){window.location="member.html" ;done="1"; }
if (username=="me2" && password=="me2") {window.location="member.html"; done=1; }
if (username=="me3" && password=="me3") {window.location="member.html"; done=1; }
if (username=="me4" && password=="me4") {window.location="member.html"; done=1; }
if (done==0) { alert("Invalid Login!");window.location="wrong.html"; }
}
function Logout(){
var log=1
if (log==1){window.location="logout.html"}
}
</script>
</head>
<body>
<form name="login">
<div>User name:<input type="username" name="username" value=""></div>
<div>Password:<input type="password" name="password" value=""></div>
<div><input type="button" value="Login" onClick="Login()"></div>
</form>
<button onclick="Logout()">Logout</button>
</body>
</html>
Capone
07-30-2003, 12:08 AM
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>Password</title>
</head>
<body>
<form>
<b>Enter Password:</b>
<input type="textbox" name="pass" size="10"> <input type="button" value="Go" onClick="location=form.pass.value+'.htm'">
</form>
</body>
</html>
Simple but effective login. Person enters the URL without the .htm, and is directed to the URL. 'course can't have individual passwords with this setup, but then the passwords are not part of the script either.