+ -
当前位置:首页 → 问答吧 → 请教ASP后台关于修改密码的问题!

请教ASP后台关于修改密码的问题!

时间:2011-08-19

来源:互联网

<%
  set rs = Server.CreateObject("ADODB.Recordset")
  if not IsEmpty(Request.QueryString("Action")) and Request.QueryString("Action")="Add" then
       password=Trim(Request.Form("password"))
       newpassword=Trim(Request.Form("newpassword"))
       rs.open "Select * from services where id="&session("id"),conn,1,3
       if rs.eof and rs.bof then
              response.Write("<script>alert('旧密码错误!');history.go(-1);</script>")
       else
              rs("password")=newpassword
              rs.update
              rs.close
              set rs=nothing:session("id")=""
              session("username")=""
              response.Write("<script>alert('密码修改成功,请使用新密码重新登录!');top.location='../index.asp';</script>")
       end if
end if
%>
<%
rs.open "select * from services where username='"&session("username")&"'",conn,1,1
%>
    <table width="750" border="0" cellpadding="5" cellspacing="1" bgcolor="#DBDBDB" class="conbody">
       <form name="form1" method="post" action="?Action=Add" onSubmit="return checkdata()">
          <tr>
            <td bgcolor="#FAFAFA" align="right">用户名:</td>
            <td align="left" bgcolor="#FAFAFA"><%=rs("username")%></td>
          </tr>  
          <tr>
            <td bgcolor="#FAFAFA" align="right">旧密码:</td>
            <td align="left" bgcolor="#FAFAFA"><%=rs("password")%><input name="password" type="password" id="password"></td>
          </tr>
                <tr>
                  <td bgcolor="#FAFAFA" align="right">新密码:</td>
            <td align="left" bgcolor="#FAFAFA"><input name="newpassword" type="password" id="newpassword"></td>
          </tr>
                <tr>
                  <td bgcolor="#FAFAFA" align="right">确认密码:</td>
            <td align="left" bgcolor="#FAFAFA"><input name="renewpassword" type="password" id="renewpassword" /></td>
          </tr>
                <tr>
            <td height="22" colspan="2" align="center" bgcolor="#FAFAFA"><input type="submit" class="button"  style="cursor:hand;" value="提交修改"></td>
          </tr>
  <input type="hidden" name="action" value="abc">
</form>
                     </table>
       </td>
              </tr>
                     </table>
                     <%call connclear()%>
始终没有找到原因在哪里 一直提示原始密码错误 请高手赐教!

作者: ahhnzhao   发布时间: 2011-08-19

输出一下sql语句。看看。

作者: lihuiluhuijie   发布时间: 2011-08-19