<!--#include file="json/conn.asp"-->
<!--#include file="inc/function.asp"-->
<!--#include file="inc/sha1.asp"-->
<%if Request.serverVariables("request_method")="POST" then
dim uid,username,password1,password2
username=f("username")
password1=f("password1")
password2=f("password2")
dim password,hkey
hkey=sha1(password1)
password=md5(password1)
dim rs
set rs=server.createobject("adodb.recordset")
rs.open "select uid,username,password,hashkey from [ar_user] where username='"&username&"' and groupid=53",conn,1,3
if not rs.eof then
uid=rs("uid")
rs("password")=password
rs("hashkey")=hkey
rs.update
else
response.write "该管理员用户不存在<a href=""#"" onclick=""window.history.go(-1)"">点此返回</a>"
response.end
end if
rs.close
password=md5(password2)
rs.open "select * from [ar_userduty] where [uid]="&uid&" and [groupid]=53 and [bid]=0",conn,1,3
if rs.eof then
rs.addnew
rs("uid")=uid
rs("groupid")=53
rs("bid")=0
rs("dutypassword")=password
rs("nametime")=now()
else
rs("dutypassword")=password
rs("nametime")=now()
end if
rs.update
rs.close
set rs=nothing
response.write "OK，密码修改成功"
else%>

<form name="form" action="changepassword.asp" method="post">
<table>
<caption>重设管理密码</caption>
<tr><td>管理员用户名</td><td><input type="text" name="username" size="20" maxlength="20" /></td></tr>
<tr><td>前台密码</td><td><input type="text" name="password1" value="" size="20" maxlength="20" /></td></tr>
<tr><td>后台密码</td><td><input type="text" name="password2" value="" size="20" maxlength="20" /></td></tr>
<tr><td>&nbsp;</td><td><input type="submit" value="确定" name="submit"/></td></tr>
</table>
</form>
<%
end if
%>