Her er et eksempel ...
------------------------------------
access.htm skal indholde følgende
------------------------------------
<HTML>
<HEAD>
<TITLE>Login Page</TITLE>
</HEAD>
<Script language=\"JavaScript\" Src=\"pswd.js\"></Script>
<BODY BGCOLOR=\"#000000\" TEXT=\"#FFFFFF\">
<CENTER>
<table>
<FORM Name=\"lgform\">
<TR><TH COLSPAN=2>Password ...</TH></TR>
<TR><TD>Login Name: </TD><TD><INPUT NAME=\"user\" TYPE=\"text\" VALUE=\"\" SIZE=\"10\" ALIGN=middle></TD></TR>
<TR><TD>Password: </TD><TD><input name=\"passwd\" type=\"password\" value=\"\" size=\"10\" ALIGN=middle></TD></TR>
<TR><TD><INPUT NAME=\"Submit\" width=80 type=\"button\" VALUE=\"Login\" ALIGN=middle onclick=\"check()\">
<TD><INPUT NAME=\"reset\" type=\"button\" value=\"Cancel\" width=80 onClick=\"self.close()\" ALIGN=middle></TR>
</FORM>
</table>
</CENTER>
</BODY>
</HTML>
------------------------------------
add_user.htm skal indholde følgende
------------------------------------
<HTML>
<HEAD>
<TITLE>Login Page</TITLE>
</HEAD>
<Script language=\"JavaScript\" Src=\"Add_User.js\"></Script>
<BODY BGCOLOR=\"#000000\" TEXT=\"#FFFFFF\">
<CENTER>
<table>
<FORM Name=\"lgform\">
<TR><TD>New User\'s Login: </TD><TD><INPUT NAME=\"user\" TYPE=\"text\" VALUE=\"\" SIZE=\"10\" ALIGN=middle></TD></TR>
<TR><TD>New User\'s Password: </TD><TD><input name=\"passwd\" type=\"password\" value=\"\" size=\"10\" ALIGN=middle></TD></TR>
<TR><TD><INPUT NAME=\"Submit\" width=80 type=\"button\" VALUE=\"Add\" ALIGN=middle onclick=\"check()\">
<TD><INPUT NAME=\"reset\" type=\"button\" value=\"Cancel\" width=80 onClick=\"self.close()\" ALIGN=middle></TR>
<TEXTAREA NAME=\"log\" WRAP=Virtual ROWS=3 COLS=50></TEXTAREA>
</FORM>
</table>
</CENTER>
</BODY>
</HTML>
------------------------------------
add_user.js skal indholde følgende
------------------------------------
<!-- Hiding
/*
This is an modification of the original Password Pro which was created by Lefteris Haritou
http://www.geocities.com/~lefPlease notice that this script among with others is copyrighted under the Greek copyright office which
make it valid worldwide except USA.
Some of my latest Script are also copyrighted under the US copyright office too
(
http://www.loc.gov/copyright/)
Edited by Howard Chen
http://start.at/javascripts/ hchen007@geocities.com
*/
var base= new Array(\"0\", \"1\", \"2\", \"3\", \"4\", \"5\", \"6\", \"7\", \"8\", \"9\",\"A\", \"B\", \"C\", \"D\", \"E\", \"F\", \"G\", \"H\", \"I\", \"J\", \"K\", \"L\", \"M\", \"N\", \"O\", \"P\", \"Q\", \"R\", \"S\", \"T\", \"U\", \"V\", \"W\", \"X\", \"Y\", \"Z\",\"a\", \"b\", \"c\", \"d\", \"e\", \"f\", \"g\", \"h\", \"i\", \"j\", \"k\", \"l\", \"m\", \"n\", \"o\", \"p\", \"q\", \"r\", \"s\", \"t\", \"u\", \"v\", \"w\", \"x\", \"y\", \"z\")
var z=23;
var y=28;
var f= new Array();
var K= new Array();
var login=new Array();
var lgnum=0;
for (x=0; x<10; x++){
f[x]=x<<9
f[x]+=23
}
for (x=10; x<36; x++){
y=y<<1
v= Math.sqrt(y)
v = parseInt(v,16)
v+=5
f[x]=v
y++
}
for (x=36; x<62; x++){
z=z<<1
v= Math.sqrt(z)
v = parseInt(v,16)
v+=74
f[x]=v
z++
}
function inc(){
iCounter--
if (iCounter > 0){
alert(\'Login / Password Incorrect\\n\\nPlease try again\')
document.lgform.user.value=\"\"
document.lgform.passwd.value=\"\"
lgnum=0
}
else
location.href=\'denied.html\'
}
function check(){
pwdchk()
}
function pwdchk(){
var pass=document.lgform.passwd.value
var lpass=pass.length
for (l=0; l<lpass; l++){
K[l]=pass.charAt(l)
}
var code=0;
for (y=0; y<lpass; y++){
for(x=0; x<62; x++){
if (K[y]==base[x])
code+=(y+1)*f[x]
}
}
if (navigator.appName == \"Netscape\")
{
document.lgform.log.value = \'login[x]=new id(\"\' + document.lgform.user.value + \'\",\' + code + \')\\n\' +
\'Copy and paste the above line in the very bottom of pswd.js\\nNotice that the x in login[x] needs to be current number of users.\\nYou should see a help at bottom of pswd.js.\'
}
else {
document.lgform.log.value = \'login[x]=new id(\"\' + document.lgform.user.value + \'\",\' + code + \')\\r\\n\' +
\'Copy and paste the above line in the very bottom of pswd.js\\nNotice that the x in login[x] needs to be current number of users.\\r\\nYou should see a help at bottom of pswd.js.\'
}
}
function id(usid,pwd){
this.usid=usid;
this.pwd=pwd;
}
//Done Hiding -->
------------------------------------
denied.htm skal indholde følgende
------------------------------------
<HTML>
<HEAD>
<TITLE>Authentication Failure</TITLE>
</HEAD>
<BODY BGCOLOR=\"#000000\" TEXT=\"#FF0000\">
<BR><BR><BR><CENTER><H1>Access Denied</H1><BR><H2>Password Incorrect<BR><BR>Your access to these password protected pages is denied.</H2></CENTER>
</FONT>
</BODY>
</HTML>
------------------------------------
pswd.js skal indholde følgende
------------------------------------
<!-- Hiding
/*
This is an modification of the original Password Pro which was created by Lefteris Haritou
http://www.geocities.com/~lefPlease notice that this script among with others is copyrighted under the Greek copyright office which
make it valid worldwide except USA.
Some of my latest Script are also copyrighted under the US copyright office too
(
http://www.loc.gov/copyright/)
Edited by Howard Chen
http://start.at/javascripts/ hchen007@geocities.com
*/
var base= new Array(\"0\", \"1\", \"2\", \"3\", \"4\", \"5\", \"6\", \"7\", \"8\", \"9\",\"A\", \"B\", \"C\", \"D\", \"E\", \"F\", \"G\", \"H\", \"I\", \"J\", \"K\", \"L\", \"M\", \"N\", \"O\", \"P\", \"Q\", \"R\", \"S\", \"T\", \"U\", \"V\", \"W\", \"X\", \"Y\", \"Z\",\"a\", \"b\", \"c\", \"d\", \"e\", \"f\", \"g\", \"h\", \"i\", \"j\", \"k\", \"l\", \"m\", \"n\", \"o\", \"p\", \"q\", \"r\", \"s\", \"t\", \"u\", \"v\", \"w\", \"x\", \"y\", \"z\")
var alphabet= \"ABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890_\"
var z=23;
var y=28;
var f= new Array();
var K= new Array();
var login=new Array();
var lgnum=0;
for (x=0; x<10; x++){
f[x]=x<<9
f[x]+=23
}
for (x=10; x<36; x++){
y=y<<1
v= Math.sqrt(y)
v = parseInt(v,16)
v+=5
f[x]=v
y++
}
for (x=36; x<62; x++){
z=z<<1
v= Math.sqrt(z)
v = parseInt(v,16)
v+=74
f[x]=v
z++
}
function encode (OrigString, CipherVal) {
Ref=\"0123456789abcdefghijklmnopqrstuvwxyz._~\"
Ref=Ref+\"ABCDEFGHIJKLMNOPQRSTUVWXYZ\"
CipherVal = parseInt(CipherVal)
var Temp=\"\"
for (Count=0; Count < OrigString.length; Count++) {
var TempChar = OrigString.substring (Count, Count+1)
var Conv = cton(TempChar)
var Cipher=Conv^CipherVal
Cipher=ntoc(Cipher)
Temp += Cipher
}
return (Temp)
}
function cton (Char) {
return (Ref.indexOf(Char));
}
function ntoc (Val) {
return (Ref.substring(Val, Val+1))
}
function inc(){
iCounter--
if (iCounter > 0){
alert(\'Login / Password Incorrect\\n\\nPlease try again\')
document.lgform.user.value=\"\"
document.lgform.passwd.value=\"\"
lgnum=0
}
else
location.href=\'denied.htm\'
}
function check(){
if (lgnum<login.length){
if (document.lgform.user.value==login[lgnum].usid)
pwdchk()
else{
lgnum++
check()
}
}
else
inc()
}
function pwdchk(){
var pass=document.lgform.passwd.value
var lpass=pass.length
for (l=0; l<lpass; l++){
K[l]=pass.charAt(l)
}
var code=0;
for (y=0; y<lpass; y++){
for(x=0; x<62; x++){
if (K[y]==base[x])
code+=(y+1)*f[x]
}
}
if (code==login[lgnum].pwd)
go(encode(document.lgform.passwd.value, lpass))
else
inc()
}
function go(site){
location.href= site + \'.htm\'
}
function id(usid,pwd){
this.usid=usid;
this.pwd=pwd;
}
var iCounter=3
//---------------------------------------------------------------------------
/* Paste your user name below this line and the logins you had pasted,
the number that should take place of \"x\" in login[x] is the number
of current users not including the one you are adding. For example,
if there is only 1 user login below, then there is 1 current user,
so you use 1 instead of x such as login[1](\"Username\",12345).
REMANBER, YOU DON\'T CHANGE THE NUMBER AFTER YOU PUT THEM DOWN, so the
numbers should be ascending, for instance, if you have three users,
their x should be login[0], login[1], and login[2]. */
//---------------------------------------------------------------------------
login[0]=new id(\"Casper\",371796)
//Done Hiding -->
Ikke så lidt kode, men det burde virker ... det er evigheder siden jeg har kigget på det sidst ...