% '*** *** *** *** *** ' 登录/找回密码 '*** *** *** *** *** dim pp set king=new kingcms king.checkplugin king.path'检查插件安装状态 set pp=new passport select case action case"" king_def case"getpass" king_getpass end select set pp=nothing set king=nothing ' *** Copyright © KingCMS.com All Rights Reserved *** sub king_def() if king_remoteurl<>"../" then response.redirect king_remoteurl&"passport/login.asp" dim ispwd,checked,sql,rs,re,loginok dim ppname,pppass,md5pass,ppkey,logcount,errtext king.pphead 0 ispwd=true:loginok=false ppname=form("ppname"):pppass=form("pppass") re=request.servervariables("http_referer") if len(form("re"))>0 then re=form("re"):if len(re)=0 then re="/" if len(ppname)>0 and len(pppass)>=6 then if king_dbtype=1 then sql="select count(logid) from kingpassport_log where ip='"&safe(king.ip)&"' and lognum=2 and getdate()-logdate<0.25;" else sql="select count(logid) from kingpassport_log where ip='"&safe(king.ip)&"' and lognum=2 and now()-logdate<0.25;" end if logcount=conn.execute(sql)(0) if logcount>=pp.loginnum then errtext="
"&pp.lang("tip/lock")&"
" else set rs=conn.execute("select ppkey,pppass,pplanguage,islock from kingpassport where ppname='"&safe(ppname)&"' and isdel=0;") if not rs.eof and not rs.bof then md5pass=md5(pppass&rs(0),1) if cstr(rs(1))=cstr(md5pass) then conn.execute "insert into kingpassport_log (ppname,lognum,ip,logdate) values ('"&safe(ppname)&"',1,'"&safe(king.ip)&"','"&tnow&"')" '写cookies response.cookies(md5(king_salt_user,0))("name")=ppname response.cookies(md5(king_salt_user,0))("pass")=md5(left(rs(0),3)&md5pass,1) if king_remoteurl="../" then response.cookies(md5(king_salt_user,0)).domain=king.url else response.cookies(md5(king_salt_user,0)).domain=king_domain end if session(md5(king_salt_user,0))=ppname&"|"&rs(2)&"|"&rs(3) if cstr(form("validity"))="0" then response.cookies(md5(king_salt_user,0)).expires=now+365 end if '登录成功后的提示 king.ol=""&pp.lang("tip/lock")&"
" else ispwd=false'response.write "您的帐号或密码有误 !还有"&(king_loginnum-logcount-1)&"次登录的机会。
" end if end if rs.close set rs=nothing end if end if if loginok=false then king.ol="" end if king.value "title",encode(pp.lang("common/login")) king.value "inside",encode(king.writeol) king.outhtm pp.template,"",king.invalue end sub ' *** Copyright © KingCMS.com All Rights Reserved *** sub king_getpass() if king_remoteurl<>"../" then response.redirect king_remoteurl&"passport/login.asp?action=getpass" king.pphead 0 dim rs,ppquestion,data,ppkey,pppass,md5pass dim is1,is2 is1=true:is2=true '提交用户名 king.ol="" '检查预置的问题和答案是否一致 if king.ismethod and king.ischeck then king.clearol king.ol="" if king.ischeck then king.clearol '更新密码 king.ol="" if king.ischeck then ppkey=salt(6):pppass=form("pass1") pppass=md5(pppass&ppkey,1) conn.execute "update kingpassport set ppkey='"&safe(ppkey)&"',pppass='"&safe(pppass)&"' where ppname='"&safe(form("ppname"))&"';"'重新写新的密码 response.cookies(md5(king_salt_user,0))("name")=form("ppname") response.cookies(md5(king_salt_user,0))("pass")=md5(left(ppkey,3)&pppass,1) if king_remoteurl="../" then response.cookies(md5(king_salt_user,0)).domain=king.url else response.cookies(md5(king_salt_user,0)).domain=king_domain end if session(md5(king_salt_user,0))=form("ppname")&"|"&king_language&"|0" '输出提示,并结束过程 king.clearol king.ol="