<% dim Action,useradmin,rsGetuserpassword,FoundErr,ErrMsg dim da,userpassword,password2 Action=replace(trim(Request("Action")),"'","") useradmin=replace(trim(Request("useradmin")),"'","") da=replace(trim(Request("da")),"'","") userpassword=replace(trim(Request("userpassword")),"'","") password2=replace(trim(Request("password2")),"'","") %> XYCMS-找回密码 <%if Action="" then%>
忘记密码 >> 第一步:输入用户名
请输入你的用户名:

<% elseif Action="step2" then if useradmin="" or strLength(useradmin)>14 or strLength(useradmin)<2 then founderr=true errmsg=errmsg & "
  • 请输入用户名(不能大于14小于2)
  • " else if Instr(useradmin,"=")>0 or Instr(useradmin,"%")>0 or Instr(useradmin,chr(32))>0 or Instr(useradmin,"?")>0 or Instr(useradmin,"&")>0 or Instr(useradmin,";")>0 or Instr(useradmin,",")>0 or Instr(useradmin,"'")>0 or Instr(useradmin,",")>0 or Instr(useradmin,chr(34))>0 or Instr(useradmin,chr(9))>0 or Instr(useradmin,"")>0 or Instr(useradmin,"$")>0 then errmsg=errmsg+"
  • 用户名中含有非法字符,请重新填写!
  • " founderr=true end if end if if FoundErr=true then call WriteErrMsg() else set rsGetuserpassword=server.createobject("adodb.recordset") rsGetuserpassword.open "select useradmin,wen,da,userpassword from [user] where useradmin='" & useradmin & "'",conn,1,1 if rsGetuserpassword.bof and rsGetuserpassword.eof then FoundErr=True ErrMsg=ErrMsg & "
  • 对不起,你输入的用户名不存在!
  • " call WriteErrMsg() else %>
    忘记密码 >> 第二步:回答问题
    密码提示问题: <%=rsGetuserpassword("wen")%>
    你的答案:

    ">    
    <% end if rsGetuserpassword.close set rsGetuserpassword=nothing end if elseif Action="step3" then if da="" then FoundErr=True ErrMsg=ErrMsg & "
  • 请输入提示问题的答案!
  • " call WriteErrmsg() else set rsGetuserpassword=server.createobject("adodb.recordset") rsGetuserpassword.open "select useradmin,wen,da,userpassword from [user] where useradmin='" & useradmin & "'",conn,1,1 if rsGetuserpassword.bof and rsGetuserpassword.eof then FoundErr=True ErrMsg=ErrMsg & "
  • 对不起,用户名不存在!可能已经被管理员删除了。
  • " call WriteErrMsg() else if rsGetuserpassword("da")<>da then FoundErr=True ErrMsg=ErrMsg & "
  • 对不起,你的答案不对!
  • " Call WriteErrMsg() else %>
    忘记密码 >> 第三步:设置新密码
    密码提示问题: <%=rsGetuserpassword("wen")%>
    你的答案: <%=da%> ">
    新密码:
    确认新密码:

    ">    
    <% end if end if rsGetuserpassword.close set rsGetuserpassword=nothing end if elseif Action="step4" then if userpassword="" or strLength(userpassword)>12 or strLength(userpassword)<6 then founderr=true errmsg=errmsg & "
  • 请输入密码(不能大于12小于6)
  • " else if Instr(userpassword,"=")>0 or Instr(userpassword,"%")>0 or Instr(userpassword,chr(32))>0 or Instr(userpassword,"?")>0 or Instr(userpassword,"&")>0 or Instr(userpassword,";")>0 or Instr(userpassword,",")>0 or Instr(userpassword,"'")>0 or Instr(userpassword,",")>0 or Instr(userpassword,chr(34))>0 or Instr(userpassword,chr(9))>0 or Instr(userpassword,"")>0 or Instr(userpassword,"$")>0 then errmsg=errmsg+"
  • 密码中含有非法字符
  • " founderr=true end if end if if password2="" then founderr=true errmsg=errmsg & "
  • 请输入确认密码(不能大于12小于6)
  • " else if userpassword<>password2 then founderr=true errmsg=errmsg & "
  • 密码和确认密码不一致
  • " end if end if if FoundErr=True then call WriteErrmsg() else set rsGetuserpassword=server.createobject("adodb.recordset") rsGetuserpassword.open "select useradmin,wen,da,userpassword from [user] where useradmin='" & useradmin & "'",conn,1,3 if rsGetuserpassword.bof and rsGetuserpassword.eof then FoundErr=True ErrMsg=ErrMsg & "
  • 对不起,用户名不存在!可能已经被管理员删除了。
  • " call WriteErrMsg() else if rsGetuserpassword("da")<>da then FoundErr=True ErrMsg=ErrMsg & "
  • 对不起,你的答案不对!
  • " Call WriteErrMsg() else rsGetuserpassword("userpassword")=md5(userpassword) rsGetuserpassword.update %>
    忘记密码 >> 第四步:成功设置新密码
    用户名: <%=useradmin%>
    新密码: <%=userpassword%>

    请牢记您的新密码并使用新密码登录

    【返 回】【关闭窗口】
    <% end if end if rsGetuserpassword.close set rsGetuserpassword=nothing end if end if %> <% Function StrLength(Str) On Error Resume Next Dim WINNT_CHINESE WINNT_CHINESE = (Len("论坛") = 2) If WINNT_CHINESE Then Dim l, t, c Dim i l = Len(Str) t = l For i = 1 To l c = Asc(Mid(Str, i, 1)) If c<0 Then c = c + 65536 If c>255 Then t = t + 1 End If Next strLength = t Else strLength = Len(Str) End If If Err.Number<>0 Then Err.Clear End Function %>