I rescently added another user and their password to a javascirpt pass word that I've been using. The script has worked in the past but for some strange reason it keeps sending people right back to the login page that the javascript is on. Here's the java script below.
<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=="james" && password=="22989") { window.location="dest.htm"; done=1; }
if (username=="joe" && password=="63408") { window.location="dest.htm"; done=1; }
if (username=="susan" && password=="blondie24") { window.location="dest.htm"; done=1; }
if (username=="christopher" && password=="64943") { window.location="dest.htm"; done=1; }
if (username=="karen" && password=="10642") {window.location="dest.htm"; done=1; }
if (username=="mike" && pasword=="48339") {window.location="dest.htm"; done=1; }
if (username=="rhonda" && password=="69570") {window.loaction="dest.htm"; done=1; }
if (usrename=="tracy" && password=="55783") {window.location="dest.htm"; done=1; }
if (done==0) { alert("Invalid login!"); }
}
// End -->
</script>
<!-- Inside Below1 -->
<form name=login>
<table border=0 cellspacing=0 cellpadding=3 >
<tr valign=top>
<td colspan=2 align=center class=error-small> <font face="Tahoma, Times New Roman, sans-serif" size="2" color="#FF0000">PLEASE
ENTER YOUR USERNAME AND PASSWORD<br>
(in lower CaSe SENSITIVE) </font> </td>
</tr>
<tr valign=top>
<td colspan=2 align=center> </td>
</tr>
<tr valign=top>
<td colspan=2 align=center class=error> </td>
</tr>
<tr valign=top>
<td nowrap align=right><b><font face="Tahoma, Times New Roman, sans-serif" size="3">USERNAME</font></b><font face="Tahoma, Times New Roman, sans-serif" size="3">
:</font> </td>
<td>
<input type=text name=username>
</td>
</tr>
<tr valign=top>
<td nowrap align=right><b><font face="Tahoma, Times New Roman, sans-serif" size="3">PASSWORD</font></b><font face="Tahoma, Times New Roman, sans-serif" size="3">
: </font> </td>
<td>
<input type=text name=password>
</td>
</tr>
<tr valign=top>
<td colspan=2 align=right><img src=images/filly.gif border=0 width="256" height="21">
<input type=image src=images/submit.gif border=0 width="115" height="18" value="Login!" onClick="Login(); return false;" name="button">
</td>
</tr>
<tr valign=top>
<td colspan=2 valign=middle align=right><img src=images/filly.gif border=0 width="256" height="21"><a href=/passretreiveal.htm><img src=images/forgot.gif border=0 width="115" height="18"></a></td>
</tr>
</table>
</form>
<!-- Finishing w/Below2 -->
</td>
</tr>
<tr>
<td align=right><img height=36 src=images/tablebot1.gif width="392"></td>
<td align=left><img width=83 height=36 src=images/tablebot2.gif></td>
</tr>
</table>
<!-- Start of Bottom Template -->
</td>
</tr>
<tr >
<td height="49" colspan=2 valign=bottom ><img src=images/edge2.gif vspace=3 width="115" height="49"><img src=images/line1.gif vspace=3 width="472" height="24"><img src=images/line2.gif vspace=3 width="24" height="24"></td>
</tr>
<tr>
<td align="center" colspan="3">
<p>For Questions, or Access Problems contact your Commanding Officer
Fleet Captain James Cecil<br>
by clicking on the <img src="images/b43.jpg" width="162" height="29" align="middle">
button. <br>
If your STARFLEET membership has expired, and you are trying to renew
<a href="https://db.sfi.org/secure/renewal.php">Click Here</a>.</p>
<p>NOTE: If you are renewing and wish to remove someone from your family
membership, <br>
please contact the Membership Processing team at <a href="mailto:membership@sfi.org">membership@sfi.org</a>
or the STARFLEET Helpdesk at <a href="mailto:helpdesk@sfi.org">helpdesk@sfi.org</a>.
Line 16 is mistyped. The "usrename" should be "username" instead.
As 007Julien pointed out, this is not a very secure way to limit access. You should be validating the password on the server instead of on the user's machine.
Bookmarks