日期:2014-05-16  浏览次数:20870 次

请能帮我修改一下用户密码修改代码
代码如下:
<%@ LANGUAGE = VBScript.Encode %>
<%response.Expires = 0%>
<!--#include file="conn.asp"-->

<script> 
function checkdata()
{
if  (document.Changpassword.Oldpassword.value.length==""){
  alert("旧密码必须输入!");
  document.Changpassword.Oldpassword.focus();
  return false;
 }
if  (document.Changpassword.Newpassword.value.length==""){
  alert("新密码必须输入!");
  document.Changpassword.Newpassword.focus();
  return false;
 }
if  (document.Changpassword.ReNewpassword.value.length==""){
  alert("请输入重复密码!");
  document.Changpassword.ReNewpassword.focus();
  return false;
 }
if (document.Changpassword.Oldpassword.value == document.Changpassword.Newpassword.value){
  alert('旧密码不能与新密码相同!');
  document.Changpassword.Newpassword.focus();
  return false;
 }
if (document.Changpassword.ReNewpassword.value != document.Changpassword.Newpassword.value){
  alert('新密码与重复密码必须相同!');
  document.Changpassword.ReNewpassword.focus();
  return false;
 }
 
}
</script>
<%
Dim action
action=Trim(Request("action"))
if action="chkAdmin" then
 ReNewpassword=Request.form("ReNewpassword")
 pid=Request.form("Oldpassword")
sql="select * From userlist where id='"&id&"'" 
set rs=server.CreateObject ("Adodb.recordset") 
rs.open sql,conn,1,3 
If Not rs.Eof then 

if rs("pid")<>pid then
Response.Write "<script>alert('旧密码输入错误!');this.location.href='user_edit.asp';</SCRIPT>"
Response.End
end if

rs("pid")=ReNewpassword
rs.update 
rs.close  
Set rs = Nothing 
Response.Write "<script>alert('密码修改成功!');this.location.href='./';</SCRIPT>"
Response.End
end if
end if
%>

<table width="100%" height="100%" border="0" cellpadding="0" cellspacing="0">
  <tr> 
    <td align="center" valign="top"> <br> <strong><br>
      </strong> <table width="336" border="0" cellpadding="2" cellspacing="1" class="table_southidc">
        <tr> 
          <td width="313" height="25" bordercolor="#6699FF" bgcolor="#6699FF" class="back_southidc"> 用户密码修改</td>
        </tr>
        <tr class="tr_southidc"> 
          <FORM name=myform  onsubmit="return myform_onsubmit()"  method=post>   
<input type=hidden name=id value=<%=id%>>         
            <td bgcolor="#6699FF"><table width="88%" border="0" align="center" cellpadding="0" cellspacing="1" class="table_southidc">
       &nbs