<!--#include file="include/conn.asp"-->
<%Call limsss(sQxa,"$$webAdmin$$")%>
<%
'=================================================
'小类循环名称
'=================================================
Function MENU2LSTARR(aaa)
	If aaa ="" Then
else
	Dim oRsme,sqlme
	sqlme= "Select Id,MenuTitle,MenuId,MenuType FROM [LstMenuSmall] where MenuId= "&aaa&" order by id asc"
	Set oRsme= Server.CreateObject("ADODB.Recordset")
	oRsme.open sqlme,oconn,1,1
	if oRsme.eof and oRsme.bof Then
	Else
		do while not oRsme.eof
			If InStr(sQx,"$$MenuSmall"&oRsme(0)&"$$")>0 Then
			Response.write "<input checked type=""checkbox"" name=""UsrCont"" value=""$$MenuSmall"&oRsme(0)&"$$"">"&oRsme(1)&" "
			Else 
			Response.write "<input type=""checkbox"" name=""UsrCont"" value=""$$MenuSmall"&oRsme(0)&"$$"">"&oRsme(1)&" "
			End If
		oRsme.movenext
		loop
	End if
	oRsme.close
	set oRsme=Nothing
End If
end Function
%>
<html>
<title>管理员管理</title>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link href="../css/lst.css" rel="stylesheet" type="text/css" />
<script>
	function selectAll() 
	{ 
	for(var i=0;i<document.form1.UsrCont.length;i++) 
	{ 
	document.form1.UsrCont[i].checked=true; 
	} 
	} 
	function unSelect() 
	{ 
	for(var i=0;i<document.form1.UsrCont.length;i++) 
	{ 
	if(document.form1.UsrCont[i].checked) 
	{ 
	document.form1.UsrCont[i].checked=false; 
	} 
	else 
	{ 
	document.form1.UsrCont[i].checked=true; 
	} 
	} 
	}
</script>
</head>
<body topmargin="0" leftmargin="0" rightmargin="0" bottommargin="0" marginwidth="0" marginheight="0">
<table width="100%" height="31" border="0" cellpadding="0" cellspacing="0" class="left_topbg" id="table2"><tr><td height="31"><div class="titlebt">管理员管理</div></td></tr></table>
<table border="1" width="100%" cellpadding="2" style="border-collapse: collapse" bordercolor="#B5D0D9" bgcolor="#FFFFFF">
	<tr>
		<td>

<%If gaozhen="eddadmininfo" Then
Response.Write ("<script language=javascript>location='/Lstalone.asp?TT=12&SS=59'</script>")
End If%>





<table border="1" width="100%" id="table3" bgcolor="#FFFFFF" style="border-collapse: collapse" bordercolor="#F6F6F6" cellspacing="0">
<tr>
<td height="30" align="center" bgcolor="#F6F6F6">用户名</td>
<td height="30" align="center" bgcolor="#F6F6F6">密码</td>
<td height="30" align="center" bgcolor="#F6F6F6">操作</td>
</tr>
<form action="?action=addadmin" method=post>
<tr>
<td height="30" align="center"><input name="aaaa"></td>
<td height="30" align="center"><input name="bbbb" type=password></td>
<td height="30" align="center"><input class="ed" type=image src="../images/ico/add.gif"></td>
</tr>
</form>
</table>
<br>
<table border="1" width="100%" id="table3" bgcolor="#FFFFFF" style="border-collapse: collapse" bordercolor="#F6F6F6" cellspacing="0">
<tr>
<td height="30" align="center" bgcolor="#F6F6F6">用户名</td>
<td height="30" align="center" bgcolor="#F6F6F6">编辑权限</td>
<td height="30" align="center" bgcolor="#F6F6F6">操作</td>
</tr>
<%
sSql="select * from LstAdmin order by Id"
Set oRs = Server.CreateObject("ADODB.Recordset")
oRs.Open sSql, oconn, 1, 1
If oRs.eof and oRs.bof then
Response.Write ""
Else
Do While Not oRs.eof%>
<tr>
<td height="30" align="center"><%if oRs("UsrAdmin")="admin" then%>admin<input type=hidden name="aaaa" value="admin"><%else%><input name="aaaa" value="<%=oRs("UsrAdmin")%>"><%end if%></td>
<td height="30" align="center">
<a href="?gaozhen=eddadmininfo&Id=<%=oRs("Id")%>"><img src=../images/ico/edit.gif></a>
</td>
<td height="30" align="center">
<a href="?action=deladmin&Id=<%=oRs("Id")%>"><img src=../images/ico/del.gif></a>
</td>
</tr>
<%
oRs.MoveNext
Loop
End If
%>
</table>		
		
		
		
		
		
		</td>
	</tr>
</table>

</body>
</html>
<%
'管理员添加
If action="addadmin" Then
if trim(request("aaaa"))="" or trim(request("bbbb"))="" then
	call alert("用户名和密码不能为空!","WebAdmin.asp")
end if
	Set oRs=server.createobject("adodb.recordset")
	sSql="Select * from [LstAdmin] where UsrAdmin='"&trim(request("aaaa"))&"'"
	oRs.open sSql,oconn,1,3
	If not oRs.eof then
	Call Alert ("用户名重复,返回重来.","-1")
	End If
		oRs.addnew
		oRs("UsrAdmin")=trim(request("aaaa"))
		oRs("UsrPass")=md5(trim(request("bbbb")),32)
		oRs.update
		oRs.close
		response.redirect "WebAdmin.asp"
	Set oRs = Nothing
End If
'管理员编辑
If action="eddadmininfo" Then
	Set oRs=server.createobject("adodb.recordset")
	sSql="Select * from [LstAdmin] where id="&Id
	oRs.open sSql,oconn,1,3
		If trim(request("bbbb"))="" Then 
		Else
		oRs("UsrPass")=md5(trim(request("bbbb")),32)
		End If
		oRs("UsrCont")=trim(request("UsrCont"))
		oRs("UsrNum")=trim(request("UsrNum"))
		oRs.update
		oRs.close
		call alert("编辑成功!","WebAdmin.asp")
	Set oRs = Nothing
End If
'删除管理员
If action="deladmin" then
		set ors=Server.CreateObject("ADODB.Recordset")
		sSql="delete * from LstAdmin WHERE Id = "&Id&" "
		ors.open sSql,oconn,1,3
		set ors=nothing
		call alert("删除成功!","WebAdmin.asp")
End if
%>
