⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 findpw.asp

📁 一个不错的论坛原代码
💻 ASP
字号:
<!--#include file="Connections.asp" -->
<!--#include file="inc_admenu.asp"-->
<!--#include file="top.asp" -->
<!--#include file="md5.asp" -->

<%cpbtitle="找回密码"
call toptitle(l_title,cpbtitle)
call head(4,cpbusername&"的控制面板首页","userindex.asp",cpbtitle)%>
  
<%
 if request.querystring("action")="username" then
  if trim(replace(request.form("username"),"'","‘"))="" then
  errornum=1
   errormsg="<LI>找不到你要找的用户,请确保你的输入是正确的</li>"
   end if
sql="select question,answer,grade from user where username='"&chktopic(request.form("username"))&"'"
set rs=conn.execute(sql)
if rs.bof or rs.eof then
 errornum=1
 errormsg="<LI>找不到你要找的用户,请确保你的输入是正确的</li>"
else
 if rs("grade")<=2 then
 errornum=1
 errormsg=errormsg&"<LI>您是论坛管理员或者总版主或者版主,只能通过联系管理员获得密码</li>"
elseif isnull(rs("question")) or isnull(rs("answer")) or rs("question")="" or rs("answer")="" then
 errornum=1
 errormsg=errormsg&"<LI>很抱歉,您要找的用户没有设置问题或者答案<LI></li>所以无法找回密码,解决方法是重新注册</li>"
end if
end if

if errornum=1 then
call error(errormsg)
else
%><div align="center">
  <center>
<table border=1 borderColor=<%=tdc2%> cellPadding=2 cellSpacing=1 width=<%=tdc3%> style="border-collapse: collapse" align=center>
    <form method="POST" action="findpw.asp?action=find">
    <tr> 
      <td align="right" width="20%" <%=tColor%> class=tdc colspan="2" height=22>
      <p align="center">找回密码第二步</td>
    </tr>
    <tr> 
      <td align="right" width="30%" bgcolor=<%=tColor2%> class=tdc>用户名:</td>
      <td align="left" width="70%" bgcolor=<%=tColor2%> class=tdc>&nbsp;<%=trim(replace(request.form("username"),"'","‘"))%>      
       
         </td>
    </tr>
 <input name="username1" type=hidden value=<%=trim(replace(request.form("username"),"'","‘"))%> > 
<tr> 
      <td align="right" width="30%"  bgcolor=<%=tColor2%> class=tdc>问题:</td>
      <td align="left" width="70%"  bgcolor=<%=tColor2%> class=tdc> &nbsp;<%=rs("question")%>      
      
         </td>
    </tr>

    <tr> 
      <td align="right" width="30%"  bgcolor=<%=tColor2%> class=tdc>请输入问题答案:</td>
      <td align="left" width="70%"  bgcolor=<%=tColor2%> class=tdc>       
      &nbsp;<input name="password" size="50" class=bdtj3> 
       </td>
    </tr>
                   <tr> 
      <td align="right" width="30%"  bgcolor=<%=tColor2%> class=tdc>
      <p align="left"> </td>
      <td align="left" width="70%"  bgcolor=<%=tColor2%> class=tdc>
       <input type="submit" value="提交" name="B1" class=bdtj> <input type="reset" value="重置" name="B2" class=bdtj> </td>
    </tr>  </form></table>
      </center>
</div>
    <%end if%>
    <% elseif request.querystring("action")="find" then

    if request.form("username1")="" then
     errornum=1
   errormsg="<LI>你输入的答案有误,无法找回你的密码</li>"
   end if

sql="select username,answer,password from user where username='"&trim(replace(request.form("username1"),"'","‘"))&"'"
set rs=conn.execute(sql)
if rs("answer")<>md5(request.form("password")) then
 errornum=1
errormsg="<LI>你输入的答案有误,无法找回你的密码</li>"
end if
   if errornum=1 then
call error(errormsg)
else
%><div align="center">
  <center>
<table border=1 borderColor=<%=tdc2%> cellPadding=2 cellSpacing=1 width=<%=tdc3%> style="border-collapse: collapse" align=center>
        <tr> 
      <td align="right" width="20%" <%=tColor%> class=tdc colspan="2" height=22>
      <p align="center">找回密码第三步</td>
    </tr>
     <form method="POST" action="findpw.asp?action=edit">
    <tr> 
      <td align="right" width="30%" bgcolor=<%=tColor2%> class=tdc height=22>请输入新密码:</td>
     
      <td align="left" width="70%" bgcolor=<%=tColor2%> class=tdc> &nbsp;          
    <input name="password" size="50" class=bdtj3 type=password>(不能超过18位或者少于6位)    <input name="username1" type=hidden value=<%=rs("username")%> >     
      </td>
    </tr>
            
   <tr> 
   <input name="answer" type=hidden value=<%=rs("answer")%> > 
      <td align="right"  width="30%"  bgcolor=<%=tColor2%> class=tdc  height=22></td>
      <td align="left" width="70%"  bgcolor=<%=tColor2%> class=tdc> &nbsp;  <input type="submit" value="提交" name="B1" class=bdtj> <input type="reset" value="重置" name="B2" class=bdtj>          
         </td>
    </tr>
    <form>
                 </table>
                   </center>
</div>
                   <%
                   end if%>
                     <% elseif request.querystring("action")="edit" then
                         if instr(Request.ServerVariables("http_referer"),""&Request.ServerVariables("server_name")&"") = 0 then
errornum=1
errormsg="<li>非法提交数据,请不要从外部提交数据</li>"
end if

     if request.form("username1")="" then
     errornum=1
   errormsg="<LI>用户出错,请不要非法提交数据</li>"
   end if
   
sql="select question,answer,grade from user where username='"&chktopic(request.form("username1"))&"'"
set rs=conn.execute(sql)
if rs.bof or rs.eof then
 errornum=1
 errormsg="<LI>找不到你要找的用户,请确保你的输入是正确的</li>"
else
 if rs("grade")<=2 then
 errornum=1
 errormsg=errormsg&"<LI>您是论坛管理员或者总版主或者版主,只能通过联系管理员获得密码</li>"
elseif isnull(rs("question")) or isnull(rs("answer")) or rs("question")="" or rs("answer")="" then
 errornum=1
 errormsg=errormsg&"<LI>很抱歉,您要找的用户没有设置问题或者答案<LI></li>所以无法找回密码,解决方法是重新注册</li>"
end if
end if

if rs("answer")<>request.form("answer") then
 errornum=1
errormsg="<LI>你输入的答案有误,无法找回你的密码</li>"
end if


   
   password=trim(request.form("password"))
   password=replace(password,"'","")
       if password="" then
errornum=1
errormsg=errormsg&"<LI>密码不能为空</li>"
end if
if len(password)>18 or len(password)<6 then
errornum=1
errormsg=errormsg&"<LI>密码不能超过18位或者少于6位</li>"
end if
 if errornum=1 then
call error(errormsg)
call bq()
response.end
end if
sql="update user set password='"&md5(password)&"' where username='"&request.form("username1")&"'"
set rs=conn.execute(sql)

succmsg="<li>您已经成功找回</li>请用新密码登陆!<li>3秒钟后将自动到登陆页面,如果您的浏览器没有跳转,请点击<a href=login.asp>此处登陆</a></li><script language=javascript>setTimeout(""location.replace('login.asp')"",5000)</script>"
call succ(succmsg)
%>

                 
  <% elseif request.querystring("action")="" then%>
  <div align="center">
  <center>
<table border=1 borderColor=<%=tdc2%> cellPadding=2 cellSpacing=1 width=<%=tdc3%> style="border-collapse: collapse" align=center>
    <form method="POST" action="findpw.asp?action=username">
    <tr> 
      <td align="right" width="20%" <%=tColor%> class=tdc1 colspan="2" height=22>
      <p align="center">找回密码第一步</td>
    </tr>
    <tr> 
      <td align="right" width="30%"  bgcolor=<%=tColor2%> class=tdc>请输入用户名:</td>
      <td align="left" width="70%"  bgcolor=<%=tColor2%> class=tdc>       
      &nbsp;<input name="username" size="50" class=bdtj3>(此程序只能修改密码) 
       </td>
    </tr>
                   <tr> 
      <td align="right" width="30%"  bgcolor=<%=tColor2%> class=tdc>
      <p align="left"> </td>
      <td align="left" width="70%"  bgcolor=<%=tColor2%> class=tdc>
       <input type="submit" value="提交" name="B1" class=bdtj> <input type="reset" value="重置" name="B2" class=bdtj> </td>
    </tr>  </form></table>
      </center>
</div>
<%end if%><!--#include file="bq.asp" -->

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -