📄 admin_usersetting.asp
字号:
<!-- #include file="conn.asp" -->
<!-- #include file="inc/const.asp" -->
<!-- #include file="inc/function.asp" -->
<!--#include file="inc/md5.asp" -->
<HTML><HEAD><TITLE>后台管理 </TITLE>
<META http-equiv=Content-Type content="text/html; charset=gb2312">
<LINK href="admin.css" type=text/css rel=stylesheet>
</HEAD>
<BODY leftMargin=0 topMargin=0>
<!-- #include file="admin_header.asp" -->
<table width="100%" border="0" cellspacing="2">
<tr>
<td width="20%" align="center" valign="top" class="tdbgleft"><!-- #include file="Admin_Left.asp" --></td>
<td class="b1" valign="top">
<%
if not isnull(cUserName) and cUserName<>"" then
if chkMaster(cUserName) then
select case request("action")
case "add"
call SaveAdd()
case "modify"
call SaveModify()
case "edit"
isEdit=True
call myform(isEdit)
case else
isEdit=False
call myform(isEdit)
end select
else
msgtitle="用户权限设置"
msginfo="<li>操作错误,你不是系统管理员,没有权限进行此项操作!</li>"
call Sysmsg(msgtitle,msginfo)
end if
else
msgtitle="用户权限设置"
msginfo="<li>操作错误,你没有登录系统!<li><a href=""User.Asp"">点此登录系统</a><li><a href=""./"" >返回频道首页</a></li>"
call Sysmsg(msgtitle,msginfo)
end if
sub SaveModify()
set rs=server.createobject("adodb.recordset")
sql="select * from Admin_UserInfo where UserID="&request.form("UserID")
rs.open sql,conn,1,3
if Trim(Request.Form("PassWord"))<>Trim(rs("PassWord")) then rs("PassWord")=md5(Trim(Request.Form("PassWord")))
if Trim(Request.Form("softdown_addflag_selID"))<>"" then
rs("SoftDown_addflag")=request.form("softdown_addflag_selID")
else
rs("SoftDown_addflag")=0
end if
if Trim(Request.Form("softdown_adminflag_selID"))<>"" then
rs("SoftDown_adminflag")=request.form("softdown_adminflag_selID")
else
rs("SoftDown_adminflag")=0
end if
if Trim(Request.Form("article_addflag_selID"))<>"" then
rs("article_addflag")=request.form("article_addflag_selID")
else
rs("article_addflag")=0
end if
if Trim(Request.Form("article_adminflag_selID"))<>"" then
rs("article_adminflag")=request.form("article_adminflag_selID")
else
rs("article_adminflag")=0
end if
rs("RealName")=Trim(Request.Form("RealName"))
rs("Address")=Trim(Request.Form("Address"))
rs("Phone")=Trim(Request.Form("Phone"))
rs("UserClass")=Trim(Request.Form("UserClass"))
if Trim(Request.Form("isActive"))<>"" then
rs("isActive")=1
else
rs("isActive")=0
end if
if Trim(Request.Form("isAdmin"))<>"" then
rs("isAdmin")=1
else
rs("isAdmin")=0
end if
rs.update
rs.close
set rs=nothing
msgtitle="保存设置"
msginfo="<li>用户设置成功!</li><li><a href='Admin_User.asp'>回到用户管理</a></li>"
call Sysmsg(msgtitle,msginfo)
end sub
sub SaveAdd()
set rs=server.createobject("adodb.recordset")
sql="select * from Admin_UserInfo where (UserID is null)"
rs.open sql,conn,1,3
rs.addnew
rs("UserName")=request.form("UserName")
rs("PassWord")=md5(request.form("PassWord"))
if Trim(Request.Form("softdown_addflag_selID"))<>"" then
rs("SoftDown_addflag")=request.form("softdown_addflag_selID")
else
rs("SoftDown_addflag")=0
end if
if Trim(Request.Form("softdown_adminflag_selID"))<>"" then
rs("SoftDown_adminflag")=request.form("softdown_adminflag_selID")
else
rs("SoftDown_adminflag")=0
end if
if Trim(Request.Form("article_addflag_selID"))<>"" then
rs("article_addflag")=request.form("article_addflag_selID")
else
rs("article_addflag")=0
end if
if Trim(Request.Form("article_adminflag_selID"))<>"" then
rs("article_adminflag")=request.form("article_adminflag_selID")
else
rs("article_adminflag")=0
end if
rs("RealName")=Trim(Request.Form("RealName"))
rs("Address")=Trim(Request.Form("Address"))
rs("Phone")=Trim(Request.Form("Phone"))
rs("CategoryName")=CategoryName
rs("RegDate")=Now()
rs("UserClass")=Trim(Request.Form("UserClass"))
if Trim(Request.Form("isActive"))<>"" then
rs("isActive")=1
else
rs("isActive")=0
end if
if Trim(Request.Form("isAdmin"))<>"" then
rs("isAdmin")=1
else
rs("isAdmin")=0
end if
rs.update
rs.close
set rs=nothing
msgtitle="添加用户"
msginfo="<li>添加用户成功!</li><br><li><a href='Admin_UserSetting.asp'>继续添加新用户</a></li><br><li><a href='Admin_User.asp'>回到用户管理</a></li>"
call Sysmsg(msgtitle,msginfo)
end sub
sub myform(isEdit)
dim Rs,SubRs
set Rs=server.createobject("adodb.recordset")
%>
<table width="100%" border="0" cellpadding="0" cellspacing="1">
<script language="JavaScript" type="text/JavaScript">
function sel_softdown_addflag() {
for (var i=0;i<document.form1.softdown_addflag_selID.length;i++) {
var e=document.form1.softdown_addflag_selID[i];
e.checked=!e.checked;
}
}
function sel_softdown_adminflag() {
for (var i=0;i<document.form1.softdown_adminflag_selID.length;i++) {
var e=document.form1.softdown_adminflag_selID[i];
e.checked=!e.checked;
}
}
function sel_article_addflag() {
for (var i=0;i<document.form1.article_addflag_selID.length;i++) {
var e=document.form1.article_addflag_selID[i];
e.checked=!e.checked;
}
}
function sel_article_adminflag() {
for (var i=0;i<document.form1.article_adminflag_selID.length;i++) {
var e=document.form1.article_adminflag_selID[i];
e.checked=!e.checked;
}
}
</script>
<form name="form1" method="post" action="admin_usersetting.asp">
<tr>
<td height="22" colspan="2" class="tdbg1">
<input type="Hidden" name="action" value='<% If isedit then%>modify<% Else %>add<% End If %>'>
<%If isedit then
rs.open "select * from Admin_UserInfo where UserID=" & cstr(request("UserID")),conn,1,1
SoftDown_addflag=rs("SoftDown_addflag")
SoftDown_adminflag=rs("SoftDown_adminflag")
Article_addflag=rs("Article_addflag")
Article_adminflag=rs("Article_adminflag")
setUserName=rs("UserName")
Response.Write("<b>设置用户</b>")
%> <input type="Hidden" name="UserID" value='<%=cstr(request("UserID"))%>'>
<%else
Response.Write("<b>添加用户</b>")
End If %> </td>
</tr>
<tr>
<td colspan="2">
<table width="100%" border="0" cellpadding="3" cellspacing="1">
<tr class="tdbg2">
<td width="15%">用户名</td>
<td><input name="UserName" type="text" id="UserName" size="32" value=<% if isedit then
response.write "'"&trim(rs("UserName"))&"' disabled"
end if %>></td>
</tr>
<tr class="tdbg2">
<td>密码</td>
<td><input name="PassWord" type="text" size="32" value=<% if isedit then response.write trim(rs("PassWord"))%>></td>
</tr>
<tr class="tdbg2">
<td>真实姓名</td>
<td><input name="RealName" type="text" size="32" value="<% if isedit then response.write trim(rs("RealName")) %>"></td>
</tr>
<tr class="tdbg2">
<td>用户邮箱</td>
<td><input name="Email" type="text" size="32" value="<% if isedit then response.write trim(rs("Email")) %>"></td>
</tr>
<tr class="tdbg2">
<td>联系地址</td>
<td><input name="Address" type="text" size="32" value="<% if isedit then response.write trim(rs("Address")) %>"></td>
</tr>
<tr class="tdbg2">
<td>联系电话</td>
<td><input name="Phone" type="text" size="32" value="<% if isedit then response.write trim(rs("Phone")) %>"></td>
</tr>
<tr class="tdbg2">
<td>帐号属性</td>
<td><input name="isActive" type="checkbox" id="isActive" value="1" <% if isedit then
if rs("isActive")=1 then response.write "checked"
end if %>>激活用户
<input name="isAdmin" type="checkbox" id="isAdmin" value="1" <% if isedit then
if rs("isAdmin")=1 then response.write "checked"
end if %>>超级管理员 用户等级<%
Response.Write("<select name=""UserClass"">")
for i=0 to ubound(UserClass)
Response.Write("<option value="""&i&""" ")
if isedit then
if i = rs("UserClass") then Response.Write("selected")
end if
Response.Write(">"&UserClass(i)&"</option>")
next
Response.Write("</select>")
if isedit then rs.close
%></td>
</tr>
</table></td>
</tr>
<tr align="center">
<td width="50%" height="22" class="tdbg1"><strong>软件权限</strong></td>
<td class="tdbg1"><strong>文章权限</strong></td>
</tr>
<tr>
<td valign="top"> <table width="100%" border="0" align=center cellpadding="2" cellspacing="1">
<tr class="tdbg1">
<td width="40" align="center"><a href="javascript:sel_softdown_addflag()">发布权</a></td>
<td width="40" align="center"><a href="javascript:sel_softdown_adminflag()">管理权</a></td>
<td align="center">分类名称 </td>
</tr>
<%
sql="select * from SoftDown_Catalog order by rootid,orders"
rs.open sql,conn,1,1
do while not rs.eof
%>
<tr class="tdbg2">
<td align="center" ><input type="checkbox" name="softdown_addflag_selID" value="<%= rs("CatalogID") %>" <% if chk_isflag(rs("CatalogID"),SoftDown_addflag) then response.write "checked" %>></td>
<td width=40 align="center" ><input type="checkbox" name="softdown_adminflag_selID" value="<%= rs("CatalogID") %>" <% if chk_isflag(rs("CatalogID"),SoftDown_adminflag) then response.write "checked" %>></td>
<td >
<%
if rs("depth") =1 then Response.Write " <font color=""#666666"">├</font>"
if rs("depth") >1 then
for i=2 to rs("depth")
Response.Write " <font color=""#666666"">│</font>"
next
Response.Write " <font color=""#666666"">├</font> "
end if
if rs("parentid")=0 then Response.Write("<b>")
Response.Write rs("CatalogName")
if rs("child")>0 then Response.Write "("&rs("child")&")"
%>
</td>
</tr><%
rs.movenext
loop
rs.close
%>
</table></td>
<td valign="top"><table width="100%" border="0" align=center cellpadding="2" cellspacing="1">
<tr class="tdbg1">
<td width="40" align="center"><a href="javascript:sel_article_addflag()">发布权</a></td>
<td width="40" align="center"><a href="javascript:sel_article_adminflag()">管理权</a></td>
<td align="center">分类名称 </td>
</tr>
<%
sql="select * from info_Catalog order by rootid,orders"
rs.open sql,conn,1,1
do while not rs.eof
%>
<tr class="tdbg2">
<td align="center" ><input type="checkbox" name="article_addflag_selID" value="<%= rs("CatalogID") %>" <% if chk_isflag(rs("CatalogID"),Article_addflag) then response.write "checked" %>></td>
<td width=40 align="center" ><input type="checkbox" name="article_adminflag_selID" value="<%= rs("CatalogID") %>" <% if chk_isflag(rs("CatalogID"),Article_adminflag) then response.write "checked" %>></td>
<td >
<%
if rs("depth") =1 then Response.Write " <font color=""#666666"">├</font>"
if rs("depth") >1 then
for i=2 to rs("depth")
Response.Write " <font color=""#666666"">│</font>"
next
Response.Write " <font color=""#666666"">├</font> "
end if
if rs("parentid")=0 then Response.Write("<b>")
Response.Write rs("CatalogName")
if rs("child")>0 then Response.Write "("&rs("child")&")"
%>
</td>
</tr><%
rs.movenext
loop
rs.close
set rs=nothing
%>
</table></td>
</tr>
<tr align="center">
<td colspan="2"><input type="submit" name="Submit" value="保存设置"> <input type="reset" name="Submit2" value="取消设置"></td>
</tr>
</form>
</table>
<% end sub %>
</td>
</tr>
</table>
<!-- #include file="admin_footer.asp" -->
</BODY></HTML>
<% CloseDatabase %>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -