<%
if request.cookies("buyok")("admin")="" then response.write "<meta http-equiv='refresh' content='0;URL=../admin.asp'>"
%>
<!--#include file="../include/nowshop.asp"-->
<!--#include file="../md5.asp"-->
     <%
sub checkmanage(str)
Set mrs = conn.Execute("select * from manage where username='"&request.cookies("buyok")("admin")&"'")
if not (mrs.bof and mrs.eof) then
manage=mrs("manage")
if instr(manage,str)<=0 then
response.write "<script language='javascript'>"
response.write "alert('警告：您没有此项操作的权限！');"
response.write "location.href='quit.asp';"
response.write "</script>"
response.end
else
session("buyok_admin_login")=0
end if
else 
response.write "<script language='javascript'>"
response.write "alert('没有登陆，不能执行此操作！');"
response.write "location.href='quit.asp';"
response.write "</script>"
response.end
end if
set mrs=nothing
end sub
%>
<%call checkmanage("10")%>

<script language=javascript src=../include/mouse.js></script>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<LINK href="../images/css.css" type=text/css rel=stylesheet>
<LINK href="../list/newhead.css" type=text/css rel=stylesheet>
</head>
<BODY bgcolor="#D9EAFC">

<%
admin=request.cookies("buyok")("admin")
action=request("edit")
if action<>"ok" then
%>

<table height="5"><tr><td></td></tr></table>
<TABLE cellSpacing=0 cellPadding=0 width=95% border=0 style="BORDER-RIGHT: #b1bfee 1px solid; BORDER-TOP: #b1bfee 1px solid; BORDER-LEFT: #b1bfee 1px solid; BORDER-BOTTOM: #b1bfee 1px solid" 
>
  <TBODY>
    <TR>
      <TD width="90%" bgColor=#f4f5fd><font color="#000000">　<B><font color="#FF0000">&nbsp;管理员密码修改</font></B></font></TD>
      <TD bgColor=#f4f5fd height=30><font color="#000000">&nbsp;<a href="http://www.nowshop.com.cn/help/index.asp?boardid=2&page=1" target="_blank">设置帮助</a></font></TD>
    </TR>
  </TBODY>
</TABLE>
		  <table height="5"><tr><td></td></tr></table>

<table width="95%"  border="0" cellpadding="0" cellspacing="1" bgcolor="#b1bfee">
  <form action=safe2.asp method=post>
    <tr bgcolor="#FFFFFF">
      <td width=20% height="18" align=right>管理员名称</td>
      <td><input type="text" name="Username" size="20" value="<%=admin%>" readonly> 
        &nbsp;&nbsp; <img src=../images/admin/memo.gif alt="管理员名称不能修改<br>可添加新管理员后删除老管理员"> 
      </td>
    </TR>
    <tr bgcolor="#FFFFFF">
      <td width=20% height="18" align=right>请您输入旧密码</td>
      <td><input type="password" name="Pass0" size="20"  maxlength=16> </td>
    </tr>
    <tr bgcolor="#FFFFFF">
      <td width=20% height="18" align=right>请您输入新密码</td>
      <td><input type="password" name="Pass1" size="20"  maxlength=16> &nbsp;&nbsp; 
        <img src=../images/admin/memo.gif alt="密码长度：8-16位<br>建议使用数字和字母组合"> </td>
    </TR>
    <tr bgcolor="#FFFFFF">
      <td width=20% height="18" align=right>请您确认新密码</td>
      <td><input type="password" name="Pass2" size="20"  maxlength=16> &nbsp;&nbsp; 
        <img src=../images/admin/memo.gif alt="确认新密码"> </td>
    </TR>
    <tr bgcolor="#FFFFFF">
      <td colspan=2><input type="submit" name="Submit" value="确认修改"> <input type="hidden" name="edit" value="ok"></td>
    </tr>
  </form>
</table>
<table height="5"><tr><td></td></tr></table>

<%   
else
	if buyoktxtcheck(Request("pass0"))<>Request("pass0") or buyoktxtcheck(Request("pass1"))<>Request("pass1") or buyoktxtcheck(Request("pass2"))<>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("pass0"))="" or 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")))<5 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 manage where username='"&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 manage where username='"&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("Username")=Request("Username")
		rs.update
	end if
	set rs=nothing

	response.write "<script language='javascript'>"
	response.write "alert('密码更新成功，请牢牢记住您的新密码！！\n\n现在将退出管理中心，请用新密码重新登录！');"
	response.write "location.href='quit.asp';"			
	response.write "</script>"

end if

%>
<table width="95%" border="0">
  <tr> 
    <td height="60"><font color="#FF0000">我们将为购买正版NowShop商城系统者免费设计全套广告图片；提供免费安装调试；免费送1%网银接口、支付宝接口；免费提供技术支持；免费提供系统升级；免费提供系统模板更换；免费代办网站ICP备案；使您的网店更具吸引力！</font></td>
  </tr>
  <tr> 
    <td><p>购买咨询或技术支持，请在周一至周五8：00-18：00间联系<br>
        Email / MSN：shop@nowshop.com.cn<br>
        电话：0551-3929843&nbsp;&nbsp;13965090551<br>
        QQ：2055008<br>
        网站：<a href="http://www.nowshop.com.cn" target="_blank">http://www.nowshop.com.cn</a><br>
        演示：<a href="http://ys.nowshop.com.cn" target="_blank">http://ys.nowshop.com.cn</a><br>
      </p>
      <p>Powerd By：NowShop商城系统 V3.0</p></td>
  </tr>
</table>
