<!--#include virtual="inc/General.inc.asp"-->
<%
CheckManageUser()
actions = request.querystring("action")
userid = request.querystring("userid")
if lcase(actions)="del" then
	conn.execute "delete from [manage] where userid=" & cint(userid)
elseif lcase(actions)="save" then
	conn.execute "update manage set username='" & replace(Request("username"),"'","''") & "',limit='" & replace(Request("limit"),"'","''") & "',isstop=" & cint(Request("isstop")) & " where userid=" & userid
elseif lcase(actions)="add" then
	set rst1=server.createobject("adodb.recordset")
	rst1.open "select * from manage where username='" & replace(request("username"),"'","''") & "'",conn,1,1
	if rst1.recordcount > 0 then
		ErrorInfo "此用户已经存在，请重新输入！"
	else
		conn.execute "insert into [manage](username,limit,[password],isstop) values('" & replace(request("username"),"'","''") & "','" & replace(request("limit"),"'","''") & "','" & md5(Request("password")) & "',0)"
	end if
	rst1.close
	set rst1=nothing
end if
%>
<html>

<head>
<meta http-equiv="content-type" content="text/html;charset=gb2312">
<title>商城后台管理系统</title>
<link rel="stylesheet" href="../../css/info.css"></link>
</head>

<body topmargin="0" leftmargin="0">
<table border="0" width="100%" cellspacing="0" cellpadding="0" align="right">
  <tr>
	<td height="23" class="address">&nbsp;&nbsp;位置：用户管理</td>
  </tr>
  <tr>
	<td height="10"></td>
  </tr>
  <tr>
	<td align="right">
	  <table border="0" cellpadding="1" cellspacing="1" width="99%" bgcolor="#005BAA">
		<tr height="22" bgcolor="#AFD6FF">
		  <td align="center" nowrap>用户ID</td>
		  <td align="center" nowrap>登录名</td>
		  <td align="center" nowrap>权限</td>
		  <td align="center" nowrap>是否有效</td>
		  <td align="center" nowrap>修改</td>
		  <td align="center" nowrap>删除</td>
		</tr>
		<%set rs=server.createobject("adodb.recordset")
		rs.open "select * from manage order by userid",conn,1,1
		rs_index = 0
		while not rs.eof
		rs_index = rs_index + 1
		if lcase(actions&"")="edit" and userid&""=rs("userid")&"" then%>
		<form name="PriceClass_Form" Method="get" action="user.asp">
		<tr height="25" bgcolor="<%if rs_index mod 2 = 1 then response.write "#FFFFFF" else response.write "#EFEFEF" end if%>">
		  <td align="center" nowrap><input type="hidden" name="action" value="save"><input type="hidden" name="userid" value="<%=userid%>"><%=rs("userid")%></td>
		  <td align="center" nowrap><input type="text" name="username" value="<%=rs("username")%>" onchange="this.value=this.value.replace(/(^\s*)|(\s*$)|[\']/gi,'');" class="inbox" size="10"></td>
		  <td align="center" nowrap><input type="text" name="limit" value="<%=rs("limit")%>" onchange="this.value=this.value.replace(/[^0-9\,]/gi,'')" size="38" class="inbox"></td>
		  <td align="center" nowrap><input type="radio" name="isstop" value="0" <%if rs("isstop")&""="0" then response.write "checked"%>>是　<input type="radio" name="isstop" value="1" <%if rs("isstop")&""="1" then response.write "checked"%>>否</td>
		  <td align="center" nowrap><a href="#" onclick="javascript:PriceClass_Form.submit()">确定</a>　<a href="user.asp">取消</a></td>
		  <td align="center" nowrap><a style="cursor:hand" class="a" onclick="javascript:if(confirm('你确定要删除此范围吗？')){window.location.href='user.asp?userid=<%=rs("userid")%>&action=del';}">删除</a></td>
		</tr>
		</form>
		<%else%>
		<tr height="25" bgcolor="<%if rs_index mod 2 = 1 then response.write "#FFFFFF" else response.write "#EFEFEF" end if%>">
		  <td align="center" nowrap><%=rs("userid")%></td>
		  <td align="center"><%=rs("username")%></td>
		  <td align="center" nowrap class="entxt"><%=rs("limit")%></td>
		  <td align="center" nowrap class="entxt"><%if rs("isstop")&""="1" then response.write "否" else response.write "是"%></td>
		  <td align="center" nowrap><a href="user.asp?userid=<%=rs("userid")%>&action=edit&p=<%=p%>">修改</a></td>
		  <td align="center" nowrap><a href="#" onclick="javascript:if(confirm('你确定要删除此类别吗？')){window.location.href='user.asp?userid=<%=rs("userid")%>&action=del';}">删除</a></td>
		</tr>
		<%end if
		rs.movenext
		wend
		rs.close%>
	  </table>
	  <table border="0" cellpadding="0" cellspacing="0" width="99%">
		<tr>
		  <td height="50" align="right">
			<a href="#" onclick="javascript:if (document.all['newClassLayer'].style.visibility=='hidden'){document.all['newClassLayer'].style.visibility='visible';document.all['newClassLayer'].style.position=''}else{document.all['newClassLayer'].style.visibility='hidden';document.all['newClassLayer'].style.position='absolute';}">添加新用户</a></td>
		  </td>
		</tr>
		<tr>
		  <td align="right">
			<div id="newClassLayer" style="visibility:hidden;position:absolute;width:200;left:0;top:0">
			  <table border="0" cellpadding="1" cellspacing="1" bgcolor="#CCCCCC">
				<form method="get" action="user.asp">
				<tr>
				  <td bgcolor="#FBFBFB" height="25" nowrap><input type="hidden" name="action" value="add">　登录名：<input type="text" name="username" class="inbox" value="" onchange="this.value=this.value.replace(/(^\s*)|(\s*$)|[\']/gi,'');">&nbsp;&nbsp;</td>
				</tr>
				<tr>
				  <td bgcolor="#F4F4F4" height="25">　权　限：<input name="limit" class="inbox" onchange="this.value=this.value.replace(/[^0-9\,]/gi,'')"></td>
				</tr>
				<tr>
				  <td bgcolor="#FBFBFB" height="25">　密　码：<input type="password" name="password" class="inbox" onchange="this.value=this.value.replace(/(^\s*)|(\s*$)|[\']/gi,'')"></td>
				</tr><input type="hidden" name="isstop" value="0">
				<tr>
				  <td bgcolor="#F4F4F4" height="25" align="center"><input type="submit" value=" 确定 " class="btn">　<input type="button" value=" 取消 " class="btn" onclick="javascript:if (document.all['newClassLayer'].style.visibility=='hidden'){document.all['newClassLayer'].style.visibility='visible';document.all['newClassLayer'].style.position=''}else{document.all['newClassLayer'].style.visibility='hidden';document.all['newClassLayer'].style.position='absolute';}"></td>
				</tr>
				</form>
			  </table>
			</div>
		  </td>
		</tr>
	  </table>
	</td>
  </tr>
</table>
</body>

</html>
<%set rs=nothing
CloseConnection%>