<!--#include file="../../Conn.asp" -->
<!--#include file="../../Comm/Site_Class.asp" -->
<!--#include file="../../Comm/md5.asp" -->
<%
PagePath = "../../"

Set Qsite = New Site_Class

Qsite.SiteConfig_Master()
%>
<!--#include file="../Check_Login.asp" -->
<%
Qsite.Check_AdminFlag(arrAdminFlag(9 , 2))

Dim strAdminName,strIsLock,strPage
Dim AdminId
Dim AdminName,AdminPass1,AdminPass2,IsLock,AdminType
Dim AdminFlag

Set Rs = server.createobject("ADODB.Recordset")

If Request.Form <> "" Then
	AdminId = Qsite.chgStr(Trim(Request.Form("AdminId")))
	strAdminName = Qsite.chgStr(Trim(Request.Form("strAdminName")))
	strIsLock = Qsite.chgStr(Trim(Request.Form("strIsLock")))
	strPage = Qsite.chgStr(Trim(Request.Form("strPage")))
	
	AdminName = Qsite.chgStr(Trim(Request.Form("AdminName")))
	AdminPass1 = Qsite.chgStr(Trim(Request.Form("AdminPass1")))
	AdminPass2 = Qsite.chgStr(Trim(Request.Form("AdminPass2")))
	IsLock = Qsite.chgStr(Trim(Request.Form("IsLock")))
	
	If Cstr(AdminId) = Cstr(Session("AdminId")) Then
		Qsite.ShowMsg "不能修改自己的帐号" , ""
	End If
	
	If AdminPass1 <> "" And AdminPass1 <> AdminPass2 Then
		Qsite.ShowMsg "输入的登录密码和确认密码不一致" , ""
	End If
	
	If IsLock <> "1" Then IsLock = "0"
	
	AdminType = "0"
	
	If AdminPass1 <> "" Then AdminPass1 = MD5(AdminPass1)
	
	AdminFlag = "0|1|1|1|1|1|1|1|1|1|1"
	AdminFlag = AdminFlag & "$0|1|1|1|1|1|1|1|1|1|1"
	AdminFlag = AdminFlag & "$0|1|1|1|1|1|1|1|1|1|1"
	AdminFlag = AdminFlag & "$0|1|1|1|1|1|1|1|1|1|1"
	AdminFlag = AdminFlag & "$0|1|1|1|1|1|1|1|1|1|1"
	AdminFlag = AdminFlag & "$0|1|1|1|1|1|1|1|1|1|1"
	AdminFlag = AdminFlag & "$0|1|1|1|1|1|1|1|1|1|1"
	AdminFlag = AdminFlag & "$0|1|1|1|1|1|1|1|1|1|1"
	AdminFlag = AdminFlag & "$0|1|1|1|1|1|1|1|1|1|1"
	AdminFlag = AdminFlag & "$0|1|1|1|1|1|1|1|1|1|1"
	
	Rs.Open "select * from AdminTbl where AdminId = "& AdminId , Conn , 3 , 2
	If AdminPass1 <> "" Then
		Rs("AdminPass1") = AdminPass1
	End If
	Rs("AdminType") = AdminType
	Rs("AdminFlag") = AdminFlag
	Rs("IsLock") = IsLock
	Rs.Update
	Rs.Close
	
	Qsite.ShowMsg "管理员修改成功" , "Admin_Manage.asp?AdminName="& strAdminName &"&IsLock="& strIsLock &"&page="& strPage
End If

AdminId = Qsite.chgStr(Trim(Request.QueryString("AdminId")))
strAdminName = Qsite.chgStr(Trim(Request.QueryString("strAdminName")))
strIsLock = Qsite.chgStr(Trim(Request.QueryString("strIsLock")))
strPage = Qsite.chgStr(Trim(Request.QueryString("strPage")))

If AdminId = "" Or Not IsNumeric(AdminId) Then AdminId = 0
If strPage = "" Or Not IsNumeric(strPage) Then strPage = 0

Rs.Open "select * from AdminTbl where AdminId = "& AdminId , Conn , 1 , 1
If Rs.Eof Then
	Qsite.ShowMsg "管理员不存在" , ""
Else
	AdminName = Rs("AdminName")
	AdminFlag = Rs("AdminFlag")
	IsLock = Rs("IsLock")
End If
Rs.Close
%>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>修改管理员</title>
<link href="../skins/css/main.css" rel="stylesheet" type="text/css">
<script language="javascript">
function CheckForm()
{
	if(PosForm.AdminPass1.value != "" && PosForm.AdminPass1.value != PosForm.AdminPass2.value)
	{
		alert("输入登录密码和确认密码不一致");
		return false;
	}
	return true;
}
</script>
</head>

<body>
<form name="PosForm" method="post" action="Admin_Edit.asp" style="margin:0" onSubmit="return CheckForm();">
	<table width="100%" border="0" cellspacing="1" cellpadding="5">
		<tr>
			<td height="25" colspan="2" class="td_title">修改管理员
			<input name="AdminId" type="hidden" id="AdminId" value="<%=AdminId%>">
			<input name="strAdminName" type="hidden" id="strAdminName" value="<%=strAdminName%>">
			<input name="strIsLock" type="hidden" id="strIsLock" value="<%=strIsLock%>">
			<input name="strPage" type="hidden" id="strPage" value="<%=strPage%>"></td>
		</tr>
		<tr>
			<td width="12%" height="23" class="td_content">用户名：</td>
			<td width="88%" height="23" class="td_content"><input name="AdminName" type="text" class="input_1" id="AdminName" value="<%=AdminName%>" size="40" readonly></td>
		</tr>
		<tr>
			<td height="23" class="td_content">登录密码：</td>
			<td height="23" class="td_content"><input name="AdminPass1" type="password" class="input_1" id="AdminPass1" size="40"></td>
		</tr>
		<tr>
			<td height="23" class="td_content">确认密码：</td>
			<td height="23" class="td_content"><input name="AdminPass2" type="password" class="input_1" id="AdminPass2" size="40"></td>
		</tr>
		<tr>
			<td height="23" class="td_content">是否锁定：</td>
			<td height="23" class="td_content"><input name="IsLock" type="checkbox" id="IsLock" value="1" <%If IsLock = "1" Then Response.Write("checked")%>></td>
		</tr>
		<tr>
			<td height="23" class="td_content">&nbsp;</td>
			<td height="23" class="td_content"><input name="Submit" type="submit" class="input_1" value=" 修  改 "> 
			&nbsp;
			<input name="Submit" type="reset" class="input_1" value=" 重  置 ">
			&nbsp;
			<input name="Submit" type="button" class="input_1" value=" 返  回 " onClick="javascript:history.back();"></td>
		</tr>
	</table>
</form>
</body>
</html>
