<!--#include file="../include/nowshop.asp"-->
<!--#include file="../md5.asp"-->
<!--#include file="checkadmin.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")%>
<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">
<%
action=request("add")
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">添加管理员</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=safe3.asp method=post>
    <tr bgcolor="#FFFFFF">
      <td width=20% align=right height="18">管理员名称</td>
      <td><input type="text" name="Username" size="20" value="" maxlength=16> 
        &nbsp;&nbsp; <img src=../images/admin/memo.gif alt="用户名长度：6-16位，可使用中文和字母"> 
      </td>
    </TR>
    <tr bgcolor="#FFFFFF">
      <td width=20% align=right height="18">请输入密码</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% align=right height="18">请确认密码</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="add" value="ok"></td>
    </tr>
  </form>
</table>

<%   
else
	if buyoktxtcheck(Request("Username"))<>Request("Username") 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("Username"))="" 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 llen(trim(Request("Username")))<6 or llen(trim(Request("Username")))>16 then
	response.write "<script language='javascript'>"
	response.write "alert('出错了，您输入的管理员名称不合要求，要求长度6-16位');"
	response.write "location.href='javascript:history.go(-1)';"
	response.write "</script>"
	response.end
	end if

	if llen(trim(Request("pass1")))<8 or llen(trim(Request("pass1")))>16 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

	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

	Set rs = conn.Execute("select * from manage where username='"&request.form("username")&"'")
	if not (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>"
	response.end
	end if

	Set rs=Server.CreateObject("ADODB.Recordset")
	sql="select * from manage"
	rs.open sql,conn,1,3
		rs.addnew
		rs("username")=Request.form("Username")
		rs("password")=md5(Request("pass1"))
		rs("manage")="|01|02|03|04|05|06|07|08|09|10|11|12"
		rs.update
		rs.close
		set rs=nothing

	response.write "<script language='javascript'>"
	response.write "alert('操作成功，您已经成功添加一个管理员。\n\n接下来，请为该管理员设置权限！');"
	response.write "location.href='safe4.asp?admin="&Request.form("Username")&"';"
	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-5123308&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.5</p></td>
  </tr>
</table>
