📄 admin_usergroup.asp
字号:
<%@LANGUAGE="VBSCRIPT" CODEPAGE="936"%>
<%Option Explicit%>
<!--#include file="../../Conn.asp"-->
<!--#include file="../../SysCls/KS_CommonCls.asp"-->
<!--#include file="../Inc/Session.asp"-->
<%
'===================================================================================================================
'软件名称:科汛网站管理系统
'当前版本:科汛网站管理系统 V2.2 0628免费正式版
'Copyright (C) 2006-2008 Kesion.Com All rights reserved.
'产品咨询QQ:9537636,41904294
'技术支持QQ:111394,54004407
'程序版权:科汛网络
'程序开发:科汛网络开发组(总策划:林文仲)
'E-Mail :kesioncms@hotmail.com webmaster@kesion.com
'官方网站:http://www.kesion.com
'演示站点:http://test.kesion.com
'郑重声明:
' ①、免费版本请在程序首页保留版权信息,并做上本站LOGO友情连接,商业版本无此要求;
' ②、任何个人或组织不得在授权允许的情况下删除、修改、拷贝本软件及其他副本上一切关于版权的信息;
' ③、科汛网络保留此软件的法律追究权利
'===================================================================================================================
Dim KSCls
Set KSCls = New Admin_UserGroup
KSCls.Execute()
Set KSCls = Nothing
Class Admin_UserGroup
Private KSCMS
Private MaxPerPage
Private RS,Sql
Private ComeUrl
Private ValidDays,tmpDays,BeginID,EndID,FoundErr,ErrMsg
Private iCount,Action,sPowerType,sDescript,sPowerList
Private Sub Class_Initialize()
MaxPerPage=20
Set KSCMS=New CommonCls
End Sub
Private Sub Class_Terminate()
Call KSCMS.CloseConn()
Set KSCMS=Nothing
End Sub
Sub Execute()
If Not KSCMS.ReturnPowerResult(0, "KMUA10004") Then
Write ("<script>parent.frames['BottomFrame'].location.href='javascript:history.back();';</script>")
Call KSCMS.ReturnErr(1, "")
End If
Response.Write "<html>"
Response.Write"<head>"
Response.Write"<meta http-equiv=""Content-Type"" content=""text/html; charset=gb2312"">"
Response.Write"<link href=""../Inc/Admin_Style.CSS"" rel=""stylesheet"" type=""text/css"">"
Response.Write"</head>"
Response.Write"<body leftmargin=""0"" topmargin=""0"" marginwidth=""0"" marginheight=""0"">"
Response.Write"<table width=""100%"" height=""25"" border=""0"" cellspacing=""0"" cellpadding=""0"">"
Response.Write " <tr>"
Response.Write" <td height=""25"" class=""sort""> "
Response.Write " <strong>用户组管理导航:</strong><a href=""Admin_UserGroup.asp"">管理首页</a> | <a href=""Admin_UserGroup.asp?Action=Add"">新增用户组</a>"
Response.Write " </td>"
Response.Write " </tr>"
Response.Write"</TABLE>"
Action=Trim(request("Action"))
Select Case Action
Case "Add", "Modify"
call InfoPurview()
Case "SaveAdd"
call SaveAdd()
Case "SaveModify"
call SaveModify()
Case "Del"
call Del()
Case else
call main()
End Select
if FoundErr=True then
KSCMS.ShowError(ErrMsg)
end if
response.Write "<div style=""text-align:center;color:#003300"">-----------------------------------------------------------------------------------------------------------</div>"
response.Write "<div style=""height:30px;text-align:center"">KeSion CMS V 2.2, Copyright (c) 2006-2008 <a href=""http://www.kesion.com/"" target=""_blank""><font color=#ff6600>KeSion.Com</font></a>. All Rights Reserved . </div>"
End Sub
sub main()
Set rs=Server.CreateObject("Adodb.RecordSet")
sql="select * from KS_UserGroup order by ID"
OpenConn : rs.Open sql,Conn,1,1
%>
<style type="text/css">
<!--
.STYLE1 {color: #FF0000}
-->
</style>
<table style="MARGIN-TOP: 10px" border="0" align="center" width="96%" cellpadding="0" cellspacing="1" bgcolor="#CCCCCC">
<tr align="center" bgcolor="#F4F4EA">
<td width="45" height="30"><strong>ID号</strong></td>
<td width="168" height="22"><strong>用户组名称</strong></td>
<td width="390" bgcolor="#F4F4EA"><strong>用户组简介</strong></td>
<td width="91"><strong>用户组类型</strong></td>
<td width="120"><strong>会员数量</strong></td>
<td width="150" height="22"><strong> 操 作</strong></td>
</tr>
<%do while not rs.EOF
%>
<tr height="40" align="center" bgcolor="#ffffff" onMouseOver="this.style.background='#F5f5f5'" onMouseOut="this.style.background='#FFFFFF'">
<td width="45"><%=rs("ID")%></td>
<td><%=rs("GroupName")%></td>
<td width="390"><%=rs("Descript")%> </td>
<td width="91"><%
if rs("Type")<>0 then
Response.Write "用户"
else
Response.Write "<font color=#ff0033>系统</font>"
end if
%> </td>
<td width="120"><%=Conn.Execute("Select Count(UserID) From KS_User Where GroupID=" & RS("ID"))(0)%></td>
<td width="150"><%
Response.Write "<a href='Admin_UserGroup.asp?Action=Modify&ID=" & rs("ID") & "'>修改</a> "
if rs("Type")<>0 then Response.Write "<a href='Admin_UserGroup.asp?Action=Del&ID=" & rs("ID") & "' onClick=""return confirm('确定要删除此用户组吗?');"">删除</a>"
%>
<a href="admin_user.asp?UserSearch=10&GroupID=<%=RS("ID")%>">列出会员</a></td>
</tr>
<%
rs.MoveNext
loop
%>
</table>
<%
rs.Close:set rs=Nothing
end sub
sub InfoPurview()
Dim frmAction,sSubmit
Dim sGroupName,sGroupImg
Dim sChargeType,sValidDays,sGroupPoint
%>
<SCRIPT language=javascript>
function CheckInfo()
{
if(document.form1.GroupName.value=="")
{
alert("用户组名不能为空!");
document.form1.GroupName.focus();
return false;
}
return true;
}
</script>
<form method="post" action="Admin_UserGroup.asp" name="form1" onSubmit="return CheckInfo();">
<table width="80%" border="0" align="center" cellpadding="0" cellspacing="1" bgcolor="#CCCCCC" class="border" >
<%
if Action="Modify" then
dim GroupID
GroupID=KSCMS.ChkClng(Trim(Request("ID")))
if GroupID=0 then
FoundErr=True
ErrMsg=ErrMsg & "<br><li>请指定要修改的用户组ID</li>"
Exit Sub
end if
Set rs=Conn.Execute("Select * from KS_UserGroup where ID=" & GroupID)
if rs.Bof and rs.EOF then
FoundErr=True
ErrMsg=ErrMsg & "<br><li>不存在此用户组!</li>"
Exit Sub
end if
sGroupName = rs("GroupName")
sDescript = rs("Descript")
sChargeType = rs("ChargeType")
sValidDays = rs("ValidDays")
sGroupPoint = rs("GroupPoint")
sPowerType = rs("PowerType")
sPowerList = rs("PowerList")
frmAction = "Modify"
sSubmit = "修改"
else
sGroupName = ""
sChargeType = 1
sValidDays = 0
sGroupPoint = 0
sDescript = ""
frmAction = "Add"
sSubmit = "新增"
end if
%>
<tr class="title">
<td height="25" colspan="2" align="center" bgcolor="#F4F4EA"><font size="2"><strong><%=sSubmit%>用户组</strong></font></td>
</tr>
<tr>
<td width="300" height="30" align="right" bgcolor="#FFFFFF"><div align="right"><strong>用户组名称:</strong></div></td>
<td height="30" bgcolor="#FFFFFF"> <input name="GroupName" type="text" size=30 value="<%=sGroupName%>"> </td>
</tr>
<tr>
<td height="30" align="right" bgcolor="#FFFFFF"><div align="right"><strong>用户组简介:</strong></div></td>
<td height="30" bgcolor="#FFFFFF"><textarea name="Descript" cols="50" rows="5" id="Descript"><%=sDescript%></textarea></TD>
</tr>
<tr>
<td width="35%" height="30" align="right" bgcolor="#FFFFFF"><div align="right"><strong>计费 方式:</strong></div></td>
<td width="65%" height="30" bgcolor="#FFFFFF">
<input name="ChargeType" type="radio" value="1" <%if sChargeType=1 then Response.Write " checked"%> >
扣点数<br>
默认点数:
<input name="GroupPoint" type="text" id="GroupPoint" value="<%=sGroupPoint%>" size="6" maxlength="5">
点<br>
<input type="radio" name="ChargeType" value="2" <%if sChargeType=2 then Response.Write " checked"%> >
有效期<br>
默认有效期:
<input name="ValidDays" type="text" id="ValidDays" value="<%=sValidDays%>" size="6" maxlength="5">
天<br />
<input type="radio" name="ChargeType" value="3" <%if sChargeType=3 then Response.Write " checked"%>>
<font color="red">无限期(永不过期)</font></TD>
</tr>
<tr>
<td width="35%" height="30" align="right" bgcolor="#FFFFFF"><div align="right"><strong>组权限设置:<br>
</strong></div></td>
<td width="65%" height="30" bgcolor="#FFFFFF"><div align="right">
<table width="100%" border="0" cellspacing="1" cellpadding="2">
<tr>
<td width="134"><input name="Purview_0" type="radio" value="1" checked>
拥有所有权:</td>
<td width="362">拥有前台所有权限(可以投稿、收藏、评论等)。</td>
</tr>
<tr>
<td width="134"><input name="Purview_0" disabled type="radio" value="2">
拥有部分权:</td>
<td>需要详细指定。</td>
</tr>
</table>
</div></td>
</tr>
<tr>
<td height="30" colspan="2" align="center" bgcolor="#FFFFFF">
<input name="ID" type="hidden" value="<%=GroupID%>">
<input name="Action" type="hidden" id="Action" value="Save<%=frmAction%>">
<input type="submit" name="Submit" value="确定<%=sSubmit%>用户组" style="cursor:hand;">
<input name="Cancel" type="button" id="Cancel" value=" 取 消 " onClick="window.location.href='Admin_UserGroup.asp'" style="cursor:hand;"> </td>
</tr>
</table>
</form>
<%
Set rs=Nothing
end sub
sub SaveAdd()
Dim GroupName
Dim ChargeType,ValidDays,GroupPoint,PowerType,PowerList,Descript
GroupName = Trim(Request("GroupName"))
ChargeType = KSCMS.ChkClng(Request("ChargeType"))
PowerType = KSCMS.ChkClng(Request("PowerType"))
PowerList = KSCMS.ChkClng(Request("PowerList"))
ValidDays = KSCMS.ChkClng(Request("ValidDays"))
GroupPoint = KSCMS.ChkClng(Request("GroupPoint"))
Descript =KSCMS.G("Descript")
if GroupName="" then
FoundErr=True
ErrMsg=ErrMsg & "<br><li>用户组名称不能为空!</li>"
end if
if Not IsNumeric(Replace(Replace(PowerType,",","")," ","")) then
FoundErr=True
ErrMsg=ErrMsg & "<br><li>用户权限错误!</li>"
end if
if FoundErr=True then Exit Sub
if ChargeType<>1 and ChargeType<>2 then ChargeType=1
sql="Select * from KS_UserGroup where GroupName='"&GroupName&"'"
Set rs=Server.CreateObject("Adodb.RecordSet")
rs.Open sql,Conn,1,3
if not (rs.bof and rs.EOF) then
FoundErr=True
ErrMsg=ErrMsg & "<br><li>数据库中已经存在此用户组名称!</li>"
rs.close:set rs=Nothing
exit sub
end if
rs.addnew
rs("GroupName") = GroupName
rs("ChargeType") = ChargeType
rs("ValidDays") = ValidDays
rs("GroupPoint") = GroupPoint
rs("PowerList") = PowerList
rs("PowerType") = PowerType
Rs("Descript") = Descript
Rs("Type") = 1
rs.update
rs.Close:set rs=Nothing
Call KSCMS.Confirm("添加新用户组成功,继续添加吗?","Admin_UserGroup.asp?Action=Add","Admin_UserGroup.asp")
end sub
sub SaveModify()
Dim GroupName,GroupID
Dim ChargeType,ValidDays,GroupPoint,PowerType,PowerList,Descript
GroupID = Trim(Request("ID"))
GroupName = Trim(Request("GroupName"))
ChargeType = KSCMS.ChkClng(Request("ChargeType"))
PowerType = KSCMS.ChkClng(Request("PowerType"))
PowerList = KSCMS.ChkClng(Request("PowerList"))
ValidDays = KSCMS.ChkClng(Request("ValidDays"))
GroupPoint = KSCMS.ChkClng(Request("GroupPoint"))
Descript =KSCMS.G("Descript")
if GroupName="" then
FoundErr=True
ErrMsg=ErrMsg & "<br><li>用户组名称不能为空!</li>"
end if
if Not IsNumeric(Replace(Replace(PowerType,",","")," ","")) then
FoundErr=True
ErrMsg=ErrMsg & "<br><li>用户权限错误!</li>"
end if
if FoundErr=True then Exit Sub
if ChargeType<>1 and ChargeType<>2 then ChargeType=1
sql="Select * from KS_UserGroup where ID="&GroupID
Set rs=Server.CreateObject("Adodb.RecordSet")
rs.Open sql,Conn,1,3
if not (rs.bof and rs.EOF) then
rs("GroupName") = GroupName
rs("ChargeType") = ChargeType
rs("ValidDays") = ValidDays
rs("GroupPoint") = GroupPoint
rs("PowerList") = PowerList
rs("PowerType") = PowerType
Rs("Descript") = Descript
rs.update
else
FoundErr=True
ErrMsg=ErrMsg & "<br><li>无此用户组,参数传递出错!</li>"
end if
rs.Close:set rs=Nothing
IF FoundErr=true Then
Exit Sub
else
Response.Write ("<div align='center'>用户组权限修改成功!>><b><a href=Admin_UserGroup.asp>点击返回</a></b><div>")
end if
end sub
sub Del()
dim GroupID
GroupID=Trim(Request("ID"))
if GroupID="" then
FoundErr=True
ErrMsg=ErrMsg & "<br><li>请指定要删除的管理员ID</li>"
exit sub
end if
GroupID=Clng(GroupID)
'更改前台用户组所属组权限
if GroupID=0 then KSCMS.ShowError("<br><li>您不能删除系统用户组!</li>")
Conn.Execute("Update KS_User Set GroupID=3 where GroupID=" & GroupID)
Conn.Execute("delete from KS_UserGroup where ID=" & GroupID)
Call KSCMS.Alert("删除用户组成功!","Admin_UserGroup.asp")
end sub
End Class
%>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -