<!--#include file ="Conn.asp"-->
<!--#include file ="Check_Manager.asp"-->
<!--#include file = "Char.asp"-->
<!--#include file ="MD5.asp"-->
<%
If Request.QueryString("action")="update" Then
Call upmanager
End if
uid = Request.QueryString("id") 
Set oo = conn.execute("Select Admin From [Manager] Where id = " & uid)
If Not (oo.eof and oo.bof) Then
%>
<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 language="JavaScript" src="admin/js.js"></SCRIPT></head>
<script language="JavaScript">
<!--
function chk(theForm){
if (theForm.name.value == ""){
                alert("请输入用户名!");
                theForm.name.focus();
                return (false);
        } 
}
//-->
</script>
<body>
<table cellpadding="2" cellspacing="1" border="0" width="95%" class="tableBorder" align=center>
<form action="Admin_Edit.asp?action=update" 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 value="<%=oo(0)%>" 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">(<font color=red>如只修改用户登陆名而不修改密码请留空</font>) </td>
    </tr>
    <tr align="center"  bgcolor=ffffff> 
      <td colspan="2" class=forumrow><input type="hidden" name="id" value="<%=uid%>">
       <input type="submit" name="Submit" value="修 改"></td>
    </tr>
</form>
</table>
<%
End If
oo.close
Set oo = Nothing
Sub upmanager
na = killstr(Trim(Request.Form("name")))
id = Request.Form("id")
If Request.Form("pwd")="" Then 
Set kk = conn.execute("Update [Manager] Set [Admin]='"&na&"' where ID ="&id)
JaSys(session("ManagerUser")&"<font color=red>修改ID为"&id&"的管理员名称</font>为"&na)
If session("ManagerUser")<>na Then
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
Else
session("ManagerUser")=""
session("ManagerPwd")=""
        Response.write "<script language='javascript'>" & chr(13)
		Response.write "alert('用户名修改成功,请重新登陆!');" & Chr(13)
		Response.write "window.document.location.href='admin.htm';"&Chr(13)
		Response.write "</script>" & Chr(13)
        Response.End
End If
Else
pwd = MD5(Request.Form("pwd"))
Set kk = conn.execute("Update [Manager] Set [Admin]='"&na&"',[PassWord]='"&pwd&"' where ID ="&id)
JaSys(session("ManagerUser")&"<font color=red>修改ID为"&id&"的管理员密码和名称</font>改为"&na)
If session("ManagerUser")<>na Then
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
Else
session("ManagerUser")=""
session("ManagerPwd")=""
        Response.write "<script language='javascript'>" & chr(13)
		Response.write "alert('用户和密码修改成功,请重新登陆!');" & Chr(13)
		Response.write "window.document.location.href='admin.htm';"&Chr(13)
		Response.write "</script>" & Chr(13)
        Response.End
End if
End If
End Sub
%>