www.gusucode.com > 新锐领秀网络相册 1.1 > admin/edit_password.asp

    <!--#include file="../conn.asp"-->
<!--#include file="../include/function.asp"-->
<!--#include file="admin_func.asp"-->
<!--#include file="../include/md5.asp"-->
<!--#include file="admin_func.asp"-->
<%CheckAdmin
Dim action,old_psw,sql,rs,old_psw2,RequestURL
action = Request.querystring("action")
If action = "save" Then 
	old_psw=md5(trim(request.form("oldpass")))
	sql="select [Password] from gUser Where UserName='" & Session("admin_name") & "'"
	if not isobject(conn) then Connectiondatabase
	set rs=conn.execute(sql)
	old_psw2=rs(0)
	rs.close:Set rs = Nothing 
	if old_psw=old_psw2 then
		sql="update gUser set [Password]='"&md5(trim(request.form("pass")))&"' Where UserName='" & Session("admin_name") & "'"
		conn.execute sql
		RequestURL=Request.ServerVariables("HTTP_REFERER")
		Response.Redirect RequestURL
	else
%>
		<script language=Javascript>
			<!--
				alert("原密码错误");
				history.go(-1)
			-->
		</script>
<%	end If
Response.End()
End If %>

<script>
function check(){
if (document.input.pass.value!=document.input.pass1.value)
   {alert('两次输入密码不一致,请重新输入!');
    document.input.pass.value.focus;
    return false
    }
  }  
</script>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<link href="../images/admincp/admincp.css" rel="stylesheet" type="text/css" />
<title>修改密码</title>
</head>
<body>
<form method="POST" action="?action=save" name="input" OnSubmit="return check()"> 
  <table border="0" cellpadding="0" cellspacing="0" width="100%" align="left" class="tableborder">
	<tr class="header">
      <td height="30">
        &nbsp; .:修改密码:.  
              
       </td>      
    </tr> 
    <tr>      
      <td height="30">      
        
        原密码: <input type="password" name="oldpass" size="20" value=""> 请输入原密码!      
       
      </td>      
    </tr>
     
    <tr>      
      <td height="30" >      
         
        新密码: <input type="password" name="pass" size="20" value=""> 请记住新输入密码!      
         
      </td>      
    </tr>
    <tr>      
      <td height="30">      
       
        确认新密码: <input type="password" name="pass1" size="20" value=""> 请记住新输入密码!      
     
      </td>      
    </tr>         
    <tr>      
      <td height="30">     
       <input type="submit" value="提   交" name="B1" OnClick="return confirm('确定修改?')">   <input type="reset" value="重   写" name="B2">     
      </td>      
    </tr>      
   
  </table>     
</form>  
</body>
</html>