<!--#include file="Conn.asp"-->
<!--#include file ="Check_Manager.asp"-->
<!--#include file="MD5.asp"-->
<html><head><title>管理中心</title><meta http-equiv="Content-Type" content="text/html; charset=gb2312"><LINK href="admin/admin.css" type=text/css rel=stylesheet></SCRIPT></head>
<script language="JavaScript">
<!--
function chk(theForm){
if (theForm.name.value == ""){
                alert("请输入用户名!");
                theForm.name.focus();
                return (false);
        } 
if (theForm.pwd.value == ""){
                alert("密码不能为空!");
                theForm.pwd.focus();
                return (false);
        } 
}
//-->
</script><body text="#000000">
<%
If Request.QueryString("action")="save" Then
aname = Request.Form("name")
Set rs = conn.execute("Select [Admin] From [Manager] Where [Admin]='"&aname&"'")
If Not (Rs.Eof and Rs.Bof) Then
      Response.Write("<script language=""JavaScript"">alert(""此用户已经存在,请选择其他不存在用户名!"");history.go(-1);</script>")
Else
aname = Trim(Request.Form("name"))
pwd = MD5(Request.Form("pwd"))
Set useradd = Server.CreateObject("ADODB.RecordSet")
useradd.open "Select * From [Manager] where (ID is null)",conn,1,3
useradd.addNew
useradd("Admin") = aname
useradd("PassWord") = pwd
useradd("IP") = Request.ServerVariables("REMOTE_ADDR")
useradd("InTime") = now()
useradd.update
JaSys("管理员" & session("ManagerUser") & "<font color=red>添加管理员</font>"&aname)
        Response.write "<script language='javascript'>" & chr(13)
		Response.write "alert('用户添加成功!');" & Chr(13)
		Response.write "window.document.location.href='Admin.asp';"&Chr(13)
		Response.write "</script>" & Chr(13)
        Response.End
End If
End If
%>
<table cellpadding="2" cellspacing="1" border="0" width="95%" class="tableBorder" align=center>
<form action="Admin_Add.asp?action=save" method=post id=form1 name=form1 onSubmit="return chk(this)">
    <tr bgcolor=ffffff align="center"> 
      <th colspan=2 height=25>管理员管理－－添加管理员 </th>
    </tr>
    <tr bgcolor=ffffff>
      <td width="26%" align="right" class=forumrow>后台登陆名称：</td>
      <td width="74%" class=forumrow><input type=text name="name"></td>
    </tr>
    <tr  bgcolor=ffffff>
      <td width="26%" align="right" class=forumrow>后台登陆密码：</td>
      <td width="74%" class=forumrow><input type="password" name="pwd"></td>
    </tr>
    <tr align="center"  bgcolor=ffffff> 
      <td colspan="2" class=forumrow>
     <input type="submit" name="Submit" value="添 加"></td>
    </tr>
</form>
</table>