dolthalion
05-27-2006, 09:58 AM
I'm looking for the right javascript that will help me with a log in and password ... scripty thing. I've set up my forms, username and password, and my Log In button. My passwords and usernames are stored in the script. What I need now is that when they are accepted, all the pages of my website are updated with the words, "welcome *username*" somewhere on the page. That's all I'd like to happen. Nothing like editing profiles and their own page or stuff like that; this is just for a small project. Just a welcome *username* message.
This is the script i am using. I just don't know what else I need to put in to make this work. Am i using the wrong script for what I want to happen? I have a feeling that the destination pages are wrong for what i want to happen... I am really not good at javascript at all unfortunately!
Help WOULD be appreciated! I need this in the next two days!
SCRIPT LANGUAGE="JavaScript">
<!-- Begin
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=="member1" && password=="password1") {
window.location="index.html"; done=1; }
if (username=="member2" && password=="password2") {
window.location="index.html"; done=1; }
if (username=="member3" && password=="password3") {
window.location="index.html"; done=1; }
if (done==0) { alert("Invalid login!"); }
}
// End -->
Insert into <BODY>
<center>
</h1>
<form name=login>
<table width=225 border=1 cellpadding=3>
<tr><td colspan=2>
<p align="center"><font size="+2"><b>Log in!</b></font></p>
</td></tr>
<tr><td>Username:</td><td><input type=text name=username></td></tr>
<tr><td>Password:</td><td><input type=password name=password></td></tr>
<tr><td colspan=2 align=center><input type=button value="Login!" onClick="Login()"></td></tr>
</table>
</form>
</center>
This is the script i am using. I just don't know what else I need to put in to make this work. Am i using the wrong script for what I want to happen? I have a feeling that the destination pages are wrong for what i want to happen... I am really not good at javascript at all unfortunately!
Help WOULD be appreciated! I need this in the next two days!
SCRIPT LANGUAGE="JavaScript">
<!-- Begin
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=="member1" && password=="password1") {
window.location="index.html"; done=1; }
if (username=="member2" && password=="password2") {
window.location="index.html"; done=1; }
if (username=="member3" && password=="password3") {
window.location="index.html"; done=1; }
if (done==0) { alert("Invalid login!"); }
}
// End -->
Insert into <BODY>
<center>
</h1>
<form name=login>
<table width=225 border=1 cellpadding=3>
<tr><td colspan=2>
<p align="center"><font size="+2"><b>Log in!</b></font></p>
</td></tr>
<tr><td>Username:</td><td><input type=text name=username></td></tr>
<tr><td>Password:</td><td><input type=password name=password></td></tr>
<tr><td colspan=2 align=center><input type=button value="Login!" onClick="Login()"></td></tr>
</table>
</form>
</center>