<!--#include file="conn.asp"-->
<!--#include file="../md5.asp"-->
<%if session(hxCacheName&"_admin")<>"OK" then
    response.redirect("admin_login.asp")
    end if
%>
<script language=javascript src=../images/mouse_on_title.js></script>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<link href="../style.css" rel="stylesheet" type="text/css">
<style type="text/css">
<!--
.style1 {
	color: #FFFFFF;
	font-weight: bold;
}
body {
	background-color: #dadae9;
}
-->
</style>
</head>
<BODY background="images/back.gif">

<%dim admin,action,checktext,rs,sql,rank,user
admin=request("admin")
action=request("edit")
user=request.cookies(hxCacheName&"_ttlink")("administrator")
if action<>"ok" then
%>

	<table width="98%" border="1" 
		style="border-collapse: collapse; border-style: dotted; border-width: 0px"  
		bordercolor="#333333" cellspacing="0" cellpadding="2">
	<form action=admin_userpass.asp method=post>
	<tr class=backs><td colspan=2 class=td height=18>管理员密码修改</td></tr>
	<tr><td width=20% align=right height="18">管理员名称</td>
		<td><input type="text" readonly name="admin" size="20" value="<%=admin%>">
  &nbsp;&nbsp; <img src=../images/memo.gif alt="管理员名称不能修改<br>可添加新管理员后删除老管理员"> </td></TR>

	<tr><td width=20% align=right height="18">请您输入新密码</td>
		<td><input type="password" name="Pass1" size="20"  maxlength=15> 
  &nbsp;&nbsp; <img src=../images/memo.gif alt="密码长度：8-16位<br>建议使用数字和字母组合"> </td></TR>
	<tr><td width=20% align=right height="18">请您确认新密码</td>
		<td><input type="password" name="Pass2" size="20"  maxlength=15>
  &nbsp;&nbsp; <img src=../images/memo.gif alt="确认新密码"> </td></TR>

  
	<tr><td colspan=2><input type="submit" name="Submit" value="确认修改">
		<input type="hidden" name="edit" value="ok"></td></tr>
	</form>
	</table>
<%   
else
	

	if trim(Request("pass1"))="" or trim(Request("pass2"))="" then
	response.write "<script language='javascript'>"
	response.write "alert('出错了，填写不完整，请填写旧密码和新密码！');"
	response.write "location.href='javascript:history.go(-1)';"
	response.write "</script>"
	response.end
	end if

	if trim(Request("pass1"))<>trim(Request("pass2")) then
	response.write "<script language='javascript'>"
	response.write "alert('出错了，两次输入的新密码不符，请检查后重新输入！');"
	response.write "location.href='javascript:history.go(-1)';"
	response.write "</script>"
	response.end
	end if

	if len(trim(Request("pass1")))<8 then
	response.write "<script language='javascript'>"
	response.write "alert('出错了，您输入的新密码太短了，要求长度为8-16位，建议使用数字和字母组合！');"
	response.write "location.href='javascript:history.go(-1)';"
	response.write "</script>"
	response.end
	end if

	'旧密码正确以否判断
	'Set rs = conn.Execute("select * from admin where adminname='"&admin&"'")
	'if rs("password")<>md5(Request("pass0")) then
	'response.write "<script language='javascript'>"
	'response.write "alert('出错了，旧密码不正确，请检查后重新输入！');"
	'response.write "location.href='javascript:history.go(-1)';"
	'response.write "</script>"
	'response.end
	'end if

	Set rs=Server.CreateObject("ADODB.Recordset")
	sql="select * from admin where adminname='"&admin&"'"
	rs.open sql,conn,1,3
	if rs.eof and rs.bof then
		response.write "<script language='javascript'>"
		response.write "alert('操作失败。您未登陆，或者闲置时间过长，或者数据库中无此记录。');"
		response.write "location.href='javascript:history.go(-1)';"
		response.write "</script>"
	else
		rs("password")=md5(Request("pass1"))
		rs.update
	end if
	set rs=nothing   
	response.write "<script language='javascript'>"
	response.write "alert('修改成功！\n\n现在将退出管理中心，请用新密码重新登录！');"
	response.write "location.href='admin_login.asp?action=exit';"			
	response.write "</script>"

end if

%>
