论坛: 网站建设 标题: 一段用javascript编写的密码验证程序 复制本贴地址    
作者: admin_20cn [admin_20cn]    论坛用户   登录
我最近想学javascript,下面的东东没看懂(朋友的一个网页上搞下来的),哪位高人指点一下。
<SCRIPT>

var pass=new Array()
var t3=""
var lim=8
pass[0]="j4f7993Uqv5ho4o"
pass[1]="qsKoaJ7XrzGP1EI"
pass[2]="DhHilYorxmxkEeh"
pass[3]="MBTBMQBC7Z0cd3U"
pass[4]="8QiqJbystuOkHRly"
pass[5]="43QiqJbystuOkHRl"

var extension=".htm"
var enablelocking=0
var numletter="0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"
var temp3=''
var cur=0


function max(which){
return (pass[Math.ceil(which)+(3&15)].substring(0,1))
}

function testit(input){
temp=numletter.indexOf(input)
var temp2=temp^parseInt(pass[phase1-1+(1|3)].substring(0,2))
temp2=numletter.substring(temp2,temp2+1)
return (temp2)
}


function submitentry(){
t3=''
verification=document.password1.password2.value
phase1=Math.ceil(Math.random())-6+(2<<2)
var indicate=true
for (i=(1&2);i<window.max(Math.LOG10E);i++)
t3+=testit(verification.charAt(i))
for (i=(1&2);i<lim;i++){
if (t3.charAt(i)!=pass[phase1+Math.round(Math.sin(Math.PI/2)-1)].charAt(i))
indicate=false
}
if (verification.length!=window.max(Math.LOG10E))
indicate=false
if (indicate)
window.location=verification+extension
else
alert("密码错误,请再输入!")
}
</SCRIPT>
              <FORM name=password1>
                <TABLE style="BORDER-COLLAPSE: collapse" borderColor=#111111 
            cellSpacing=0 cellPadding=0 width=303 bgColor=#e0e0e0 border=1>
                  <TBODY> 
                  <TR> 
                    <TD borderColor=#ffffff width=299 bgColor=#000000> 
                      <DIV align=center> 
                        <CENTER>
                          <STRONG>密码: </STRONG>
                          <INPUT 
                  style="BORDER-RIGHT: #000000 1px solid; BORDER-TOP: #000000 1px solid; BORDER-LEFT: #000000 1px solid; BORDER-BOTTOM: #000000 1px solid" 
                  size=15 name=password2>
                          <INPUT onclick=submitentry() type=button value=请您进入 name=button>
                        </CENTER>
                      </DIV>
                    </TD>
                  </TR>
                  </TBODY>
                </TABLE>
              </FORM>

地主 发表时间: 06/25 15:02

论坛: 网站建设

20CN网络安全小组版权所有
Copyright © 2000-2010 20CN Security Group. All Rights Reserved.
论坛程序编写:NetDemon

粤ICP备05087286号