在user文件夹下的 ActiveCode.asp 文件,代码如下
- Sub DoCheck()
- Dim UserId:UserID=KS.ChkClng(KS.S("UserID"))
- Dim CheckNum:CheckNum=KS.S("CheckNum")
- Dim RS:Set RS=Server.CreateObject("ADODB.RECORDSET")
- RS.Open "Select top 1 UserName,RndPassWord,Email,CheckNum,locked,AllianceUser From KS_User Where UserId=" & UserId ,Conn,1,3
- If RS.Eof And RS.Bof Then
- rs.close:set rs=nothing
- Response.Write "<script>alert('对不起,用户不存在!');history.back();</script>":response.end
- else
- if rs("checknum")<>checknum then
- rs.close:set rs=nothing
- Response.Write "<script>alert('激活码有误,请重新输入!');history.back();</script>":response.end
- else
- rs("locked")=0
- rs.update
这是检查用户的激活链接中用户名和 激活码是否正确的代码,但是此处有一个问题,导致了用户可以重复的点击激活链接,进行激活!
先将该处的代码加以修改,让用户只能激活一次!
-
Sub DoCheck()
- Dim UserId:UserID=KS.ChkClng(KS.S("UserID"))
- Dim CheckNum:CheckNum=KS.S("CheckNum")
- Dim RS:Set RS=Server.CreateObject("ADODB.RECORDSET")
- RS.Open "Select top 1 UserName,RndPassWord,Email,CheckNum,locked,AllianceUser From KS_User Where UserId=" & UserId ,Conn,1,3
- If RS.Eof And RS.Bof Then
- rs.close:set rs=nothing
- Response.Write "<script>alert('对不起,用户不存在!');history.back();</script>":response.end
- else
- if rs("checknum")<>checknum then
- rs.close:set rs=nothing
- Response.Write "<script>alert('激活码有误,请重新输入!');history.back();</script>":response.end
- elseif 0 = rs("locked") then
- rs.close:set rs=nothing
- Response.Write "<script>alert('您的账号已经激活,请勿重复激活!');history.back();</script>":response.end
- else
- rs("locked")=0
- rs.update