...

View Full Version : Hellp, Savascript Login



SystemDown
08-27-2002, 04:47 AM
Hello,

i have used a script from www.javascript.com ( password protection script with the with login script creator ) and have implemented it and it works fine, although the security is very poor, i mean their is no session script for secure login, once u get to the destination with the username and passwod then you go back a page and try going to the destination page it lets you in, but it should not let you in. i am not so good in scripting and i would like to know if i get some help in this problem.

is their a session script i can implement along with the login script i have used!

i would be very gratefull if you can help me, thanx

i have attached all the files in a zip format needed to work.


below is a copy of the login source if that is all that is needed.


---------------------------------------------------------------------------------

<html>
<head><title>Login</title>
<script language="javascript">
// Login version 4.2 june 2000 Copyright D10n... diab@iinet.net.au yobo42@hotmail.com
// Courtesy of SimplytheBest.net (http://simplythebest.net/info/dhtml_scripts.html)
m=new Array();
var alpha="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789abcdefghij";

function box(part,c,r)
{ prms=new Array(r,c); typ=new Array("rowspan=","colspan=");
bx=new Array("<tr>","</tr>","</tr><tr>","</table>");
clr=new Array("808080","c0c0c0","ffffff","000000");
img='<img src="blank.gif" width=1 height=1>'; txt="";
bx[bx.length]='<table border=0 cellpadding=0 cellspacing=0>';
for(bi=0;bi<4;bi++)
{ for(bj=0;bj<2;bj++)
bx[bx.length]='<td '+typ[bj]+(2*bi+prms[bj]);
bx[bx.length]=' bgcolor="#'+clr[bi]+'">'+img+'</td>'; };
ord=new Array();
ord[0]=new Array(4,0,14,16,12,16,14,16,2,11,13,9,13,11,7,2,8,10,6,10,8,10,1);
ord[1]=new Array(0,6,10,2,9,7,2,12,16,1,3);
for(bi=0;bi<ord[part].length;bi++)
txt+=bx[ord[part][bi]]+"\n";
return txt; };

function check(frm)
{ var ary=new Array(0,1,1,7,9,8); f=new Array();
for(i=0;i<3;i++)
ary[i]=makehash(frm.elements[ary[i]].value,ary[i+3]);
for(i=0;i<m.length;i++)
if(m[i][0]==ary[0]) f[f.length]=i;
if(f.length==0) { alert("Member Not Found"); return; };
for(i=0;i<f.length;i++)
if(m[f[i]][1]==ary[1])
{ ary[2]+=" ";
for(j=2;j<m[f[i]].length;j++)
{ t=""; cnt=0;
for(k=0;k<m[f[i]][j].length;k++)
{ c=m[f[i]][j].substring(k,k+1);
a=alpha.indexOf(c,9);
if(a>-1)
{ b=a-(ary[2].substring(cnt,cnt+1)*1);
c=alpha.substring(b,b+1);
cnt=(cnt+1)%(ary[2].length-1); };
t+=c; };
m[f[i]][j]=t; };
if(m[f[i]].length>4)
{ wt='<html><body bgcolor="#bfbfbf"><center><form>'+box(0,1,1)+'<tr><td align="center">Destination<br>';
wt+='<select size=5 onchange="window.opener.window.opener.location=this.options[this.selectedIndex].value; window.opener.close(); window.close();">';
for(j=2;j<m[f[i]].length;j=j+2)
wt+='<option value="'+m[f[i]][j+1]+'">'+m[f[i]][j];
wt+='</select></td></tr>'+box(1,1,1)+'</form></body></html>';
w=window.open("","ls","width=150,height=150");
w.document.write(wt); w.document.close(); }
else { window.opener.location=m[f[i]][3]; window.close(); };
return; };
alert("Incorrect Password!");
};

function makehash(str,mult)
{ hash=0;
for (j=0;j<str.length;j++)
hash=hash*mult+alpha.indexOf(str.substring(j,j+1),0)+1;
return hash; };
</script>
<script language="javascript" src="login.js"></script>
</head>
<body bgcolor="#bfbfbf">
<center>
<form name="l">
<script language="javascript">document.write(box(0,1,1));</script>
<tr><td align="center">Member Name:<br>
<input type="text" name="mem" size=16><br>
Password:<br>
<input type="password" name="pass" size=16><br>
<input type="button" value="Login" onclick="check(this.form);">
<input type="button" value="Cancel" onclick="window.close();"></td></form></tr>
<script language="javascript">document.write(box(1,1,1));</script>
</form>
</body>
</html>

---------------------------------------------------------------------------------

:) :)



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum