www.gusucode.com > CC校友录贴吧 CCBar源码程序asp编程 > admin/admin_access.asp

    <%
'===================================================================
'= ASP FILENAME	: /admin/admin_access.asp
'= CREATED TIME : Feb,08,2004
'= LAST MODIFIED: Feb,08,2004
'= VERSION INFO : CCASP Framework Ver 2.0.1 ALL RIGHTS RESERVED BY www.cclinux.com
'= DESCRIPTION  : class base list
'= Change Log:
'===================================================================
%>

<!-- #include file = "../inc/inc_class_def.asp" -->

<!-- #include file = "../inc/inc_db_func.asp" -->
<!-- #include file = "../class/class_db.asp" -->

<!-- #include file = "../inc/inc_pub_func.asp" -->
<!-- #include file = "../inc/inc_char_func.asp" -->
<!-- #include file = "../inc/inc_data_check.asp" -->

<!-- #include file = "../class/class_html_form.asp" -->
<!-- #include file = "../class/class_html_table.asp" -->
<!-- #include file = "../main_func.asp" -->

<!-- #include file = "./admin_func.asp" -->

<!-- #include file = "../js/comm_func.js" -->

<%
Const CONST_PAGE_FILE = "admin/admin_access.asp"
GBL_strHomeURL = "../"

Call AdminCheckExec()

Dim clsPubDB
Set clsPubDB = New classDBOprt

Call SiteHead("用户管理")

Call CheckPostExist("FormAccessAdmin,ShowAccessAdmin,FormSaveAccessAdmin,DelAccessAdmin,MdyAccessAdmin,MdySaveAccessAdmin")

Call ExeSysAdminQst()


Set clsPubDB = Nothing

%>
<%
'=============== FUNCTION BODY BEGIN ===============================
'===================================================================
'= Sub         : DelAccessAdmin()
'= Time		   : Created At Jun,27,2004
'= Input       : None

'= Called by   : 
'= Calls       : 
'= Description : del access ip 
'===================================================================
Sub DelAccessAdmin()
	
	GetRSId = Trim(Request.QueryString("AccessId"))
	If Not IsNumeric(GetRSId) Then
		Call ResultExecute(E_USER_PUB,"access id错误","ES_ERR")
	End If

	clsPubDB.Clear()
	clsPubDB.AllSQL = "DELETE FROM CLASS_ACCESS WHERE ACCESS_ID=" & GetRSId
	clsPubDB.SQLExecute()
	Call ResultExecute(clsPubDB.intErrNum,"del access","ES_ERR")

	Response.Write"&nbsp;删除成功<br>"

	Response.Write "&nbsp;<a href='javascript:history.go(-1)'>返回</a>"

End Sub
'=============== End of Sub DelAccessAdmin() =======================
'===================================================================
'= Sub         : MdyAccessAdmin()
'= Time		   : Created At Jun,27,2004
'= Input       : None

'= Called by   : 
'= Calls       : 
'= Description : access ip 
'===================================================================
Sub MdyAccessAdmin()

	Dim clsForm			'== Class of form
	Dim strHtmlCode

	GetRSId = Trim(Request.QueryString("AccessId"))
	If Not IsNumeric(GetRSId) Then
		Call ResultExecute(E_USER_PUB,"access id错误","ES_ERR")
	End If

	clsPubDB.Clear()
	clsPubDB.AllSQL = "SELECT * FROM CLASS_ACCESS WHERE ACCESS_ID=" & GetRSId
	clsPubDB.SQLRSExecute()
	Call ResultExecute(clsPubDB.intErrNum,"mdy access","ES_ERR")
	
	If clsPubDB.intRSNum <= 0 Then
		Call ResultExecute(E_USER_PUB,"找不到该记录","ES_ERR")
		Exit Sub
	End If

	Set clsForm = New classForm
	clsForm.Action = "./admin_access.asp?action=MdySaveAccessAdmin&AccessId=" & GetRSId

	clsForm.Id = "frmMdyAccessAdmin"
	clsForm.Name = "frmMdyAccessAdmin"
	clsForm.OnSubmit = "return CheckMdyAccessAdmin()"
	clsForm.ColumnScale = "30%"
	clsForm.MakeForm()
	clsForm.MakeTable "0","3","1","center","98%",GBL_cssFormTable

	clsForm.AddTr GBL_cssFormTitleTr
	clsForm.AddTitle "访问控制编辑",GBL_cssFormTitleTd

	clsForm.AddTr GBL_cssFormTr
	clsForm.AddTd "*类型",GBL_cssFormTdOne,GBL_cssFormTdTwo
	clsForm.AddSelect "selActionType",""
	clsForm.AddOption "0","用户ID",clsPubDB.objPubRS("ACCESS_ACTION_TYPE")
	clsForm.AddOption "1","IP段(完全)",clsPubDB.objPubRS("ACCESS_ACTION_TYPE")
	clsForm.AddOption "2","IP段(D)",clsPubDB.objPubRS("ACCESS_ACTION_TYPE")

	clsForm.AddTr GBL_cssFormTr
	clsForm.AddTd "*IP/用户",GBL_cssFormTdOne,GBL_cssFormTdTwo
	clsForm.AddText "iptContent","40","40"
	clsForm.AddValue clsPubDB.objPubRS("ACCESS_CONTENT")

	clsForm.AddTr GBL_cssFormTr
	clsForm.AddTd "*Access类型",GBL_cssFormTdOne,GBL_cssFormTdTwo
	clsForm.AddSelect "selType",""
	clsForm.AddOption "0","禁止数据库操作",clsPubDB.objPubRS("ACCESS_TYPE")
	clsForm.AddOption "1","禁止用户登陆",clsPubDB.objPubRS("ACCESS_TYPE")

	clsForm.AddTr GBL_cssFormTr
	clsForm.AddTd "备注",GBL_cssFormTdOne,GBL_cssFormTdTwo
	clsForm.AddText "iptDesc","40","40"
	clsForm.AddValue clsPubDB.objPubRS("ACCESS_DESC")

	clsForm.AddTr GBL_cssFormSubTr
	clsForm.AddSubTd GBL_cssFormSubTd
	clsForm.AddSub "subfrmMdyAccess","提 交","submit"
	clsForm.AddSub "rstfrmMdyAccess","重 写","reset"

	clsForm.OutPutForm()
	Set clsForm = Nothing

End Sub
'============== End of Function MdyAccessAdmin() ======================
'===================================================================
'= Sub         : FormAccessAdmin()
'= Time		   : Created At Jun,27,2004
'= Input       : None

'= Called by   : 
'= Calls       : 
'= Description : access ip 
'===================================================================
Sub FormAccessAdmin()

	Dim clsForm			'== Class of form
	Dim strHtmlCode

	Set clsForm = New classForm
	clsForm.Action = "./admin_access.asp?action=FormSaveAccessAdmin"

	clsForm.Id = "frmAccessAdmin"
	clsForm.Name = "frmAccessAdmin"
	clsForm.OnSubmit = "return CheckAccessAdmin()"
	clsForm.ColumnScale = "30%"
	clsForm.MakeForm()
	clsForm.MakeTable "0","3","1","center","98%",GBL_cssFormTable

	clsForm.AddTr GBL_cssFormTitleTr
	clsForm.AddTitle "访问控制",GBL_cssFormTitleTd

	clsForm.AddTr GBL_cssFormTr
	clsForm.AddTd "*类型",GBL_cssFormTdOne,GBL_cssFormTdTwo
	clsForm.AddSelect "selActionType",""
	clsForm.AddOption "0","用户ID",""
	clsForm.AddOption "1","IP段(完全)",""
	clsForm.AddOption "2","IP段(D)",""


	clsForm.AddTr GBL_cssFormTr
	clsForm.AddTd "*IP/用户",GBL_cssFormTdOne,GBL_cssFormTdTwo
	clsForm.AddText "iptContent","40","40"

	clsForm.AddTr GBL_cssFormTr
	clsForm.AddTd "*Access类型",GBL_cssFormTdOne,GBL_cssFormTdTwo
	clsForm.AddSelect "selType",""
	clsForm.AddOption "0","禁止写数据库操作",""
	clsForm.AddOption "1","禁止用户登陆",""


	clsForm.AddTr GBL_cssFormTr
	clsForm.AddTd "备注",GBL_cssFormTdOne,GBL_cssFormTdTwo
	clsForm.AddText "iptDesc","40","40"

	clsForm.AddTr GBL_cssFormSubTr
	clsForm.AddSubTd GBL_cssFormSubTd
	clsForm.AddSub "subfrmAccessAdmin","提 交","submit"
	clsForm.AddSub "rstfrmAccessAdmin","重 写","reset"

	clsForm.OutPutForm()
	Set clsForm = Nothing

End Sub
'============== End of Function FormAccessAdmin() ======================
'===================================================================
'= Sub         : FormSaveAccessAdmin()
'= Time		   : Created At Jun,27,2004
'= Input       : None

'= Called by   : 
'= Calls       : 
'= Description : access ip
'===================================================================
Sub FormSaveAccessAdmin()

	Dim intAction,intType,strContent,strDesc

	intAction = Trim(Request.Form("selActionType"))
	strAddInfo = "类型"
	intErrId = DataCheck("DT_ENUM",intAction,strAddInfo,"0,1")
	Call ResultExecute(intErrId,strAddInfo,"ES_ERR")

	strContent = Trim(Request.Form("iptContent"))
	strAddInfo = "IP/用户"
	intErrId = DataCheck("DT_FIX_LENGTH",strContent,strAddInfo,"1|DTC_LESS_MORE_LEN|50|")
	Call ResultExecute(intErrId,strAddInfo,"ES_ERR")

	intType = Trim(Request.Form("selType"))
	strAddInfo = "Access类型"
	intErrId = DataCheck("DT_ENUM",intType,strAddInfo,"0,1")
	Call ResultExecute(intErrId,strAddInfo,"ES_ERR")

	strDesc = Trim(Request.Form("iptDesc"))
	strAddInfo = "备注"
	intErrId = DataCheck("DT_FIX_LENGTH",strDesc,strAddInfo,"0|DTC_LESS_MORE_LEN|50|")
	Call ResultExecute(intErrId,strAddInfo,"ES_ERR")

	clsPubDB.Clear()
	clsPubDB.TableName = "CLASS_ACCESS"
	clsPubDB.SQLType = "INSERT"
	clsPubDB.AddField "ACCESS_ACTION_TYPE",intAction
	clsPubDB.AddField "ACCESS_TYPE",intType
	clsPubDB.AddField "ACCESS_CONTENT",strContent
	clsPubDB.AddField "ACCESS_DESC",strDesc
	clsPubDB.SQLRSExecute()
	Call ResultExecute(clsPubDB.intErrNum,"add access","ES_ERR")

	Set clsPubDB = Nothing

	Response.Redirect "admin_access.asp?action=ShowAccessAdmin"

End Sub
'=============== End of Sub FormSaveAccessAdmin() ===================
'===================================================================
'= Sub         : MdySaveAccessAdmin()
'= Time		   : Created At Jun,27,2004
'= Input       : None

'= Called by   : 
'= Calls       : 
'= Description : access ip
'===================================================================
Sub MdySaveAccessAdmin()

	Dim intAction,intType,strContent,strDesc

	GetRSId = Trim(Request.QueryString("AccessId"))
	If Not IsNumeric(GetRSId) Then
		Call ResultExecute(E_USER_PUB,"access id错误","ES_ERR")
	End If

	intAction = Trim(Request.Form("selActionType"))
	strAddInfo = "类型"
	intErrId = DataCheck("DT_ENUM",intAction,strAddInfo,"0,1")
	Call ResultExecute(intErrId,strAddInfo,"ES_ERR")

	strContent = Trim(Request.Form("iptContent"))
	strAddInfo = "IP/用户对象"
	intErrId = DataCheck("DT_FIX_LENGTH",strContent,strAddInfo,"1|DTC_LESS_MORE_LEN|50|")
	Call ResultExecute(intErrId,strAddInfo,"ES_ERR")

	intType = Trim(Request.Form("selType"))
	strAddInfo = "Access类型"
	intErrId = DataCheck("DT_ENUM",intType,strAddInfo,"0,1")
	Call ResultExecute(intErrId,strAddInfo,"ES_ERR")

	strDesc = Trim(Request.Form("iptDesc"))
	strAddInfo = "备注"
	intErrId = DataCheck("DT_FIX_LENGTH",strDesc,strAddInfo,"0|DTC_LESS_MORE_LEN|50|")
	Call ResultExecute(intErrId,strAddInfo,"ES_ERR")

	clsPubDB.Clear()
	clsPubDB.TableName = "CLASS_ACCESS"
	clsPubDB.SQLType = "UPDATE"
	clsPubDB.AddField "ACCESS_ACTION_TYPE",intAction
	clsPubDB.AddField "ACCESS_TYPE",intType
	clsPubDB.AddField "ACCESS_CONTENT",strContent
	clsPubDB.AddField "ACCESS_DESC",strDesc
	clsPubDB.Where = "ACCESS_ID=" & GetRSId
	clsPubDB.SQLRSExecute()
	Call ResultExecute(clsPubDB.intErrNum,"add access","ES_ERR")

	Set clsPubDB = Nothing

	Response.Redirect "admin_access.asp?action=ShowAccessAdmin"

End Sub
'=============== End of Sub MdySaveAccessAdmin() ===================
'===================================================================
'= Sub		    : ShowContentAccessAdmin(objRSCont,intMaxPerPage,intPageNow)  
'= Time		    : Created At Jun,27,2004
'= Input        : objRSCont		 : db record 
'=				  intMaxPerPage  : max show number in a page
'=				  intPageNow	 : now page 
'= Output       : None
'= Called by    : 
'= Calls        : None
'= Table        : _ACCESS
'= Description  : Show access list by page
'===================================================================
Sub ShowContentAccessAdmin(objRSCont,intMaxPerPage,intPageNow)

	Dim i
	Dim clsTable			'== the object of table
	Dim strTdClass			'== td's css
	Dim strHtmlCode
	Dim intActiveType
	Dim intUpTopStatus
	Dim strTopBoardClew
	
	Set clsTable = New classTable

	'== Set table prameters
	clsTable.Border = "0"
	clsTable.CellPadding = "2"
	clsTable.CellSpacing = "1"
	clsTable.Width = "96%"
	clsTable.ClassType = GBL_cssListTable
	clsTable.Align = "center"

	clsTable.PostFile = "admin_access.asp?action=ShowAcessAdmin&pstAddType="
	clsTable.MakeTable()

	i = 0
	'== Set table header
	clsTable.AddTitleTr GBL_cssListTitleTr
	clsTable.AddTitleTd "ID",GBL_cssListTitleTd,"5%"
	clsTable.AddTitleTd "用户类型",GBL_cssListTitleTd,"16%"
	clsTable.AddTitleTd "Acess类型",GBL_cssListTitleTd,"16%"
	clsTable.AddTitleTd "IP/用户对象",GBL_cssListTitleTd,"31%"
	clsTable.AddTitleTd "备注",GBL_cssListTitleTd,"15%"
	clsTable.AddTitleTd "操作",GBL_cssListTitleTd,"*"

	Do While Not objRSCont.Eof

		i = i + 1
			
		'== Get type
		intActiveType = objRSCont("ACCESS_ACTION_TYPE")
		Select Case intActiveType
			Case	1 :
					strActiveType = "IP段(精确)"
			Case	2 :
					strActiveType = "IP段(D)"
			Case	0 :
					strActiveType = "用户"
		End Select

		intType = objRSCont("ACCESS_TYPE")
		Select Case intType
			Case	1 :
					strType = "禁止登陆"
			Case	0 :
					strType = "禁止发言"
		End Select

		If (i Mod 2) = 0 Then 
			strTdClass = GBL_cssListTd1
		Else
			strTdClass = GBL_cssListTd2
		End If	
		
		clsTable.AddTr GBL_cssListTr1
		clsTable.AddTd objRSCont("ACCESS_ID"),strTdClass
		clsTable.AddTd strActiveType,strTdClass
		clsTable.AddTd strType,strTdClass
		clsTable.AddTd objRSCont("ACCESS_CONTENT"),strTdClass
		clsTable.AddTd objRSCont("ACCESS_DESC"),strTdClass
		clsTable.AddTd "<a href=""admin_access.asp?action=DelAccessAdmin&AccessId=" & objRSCont("ACCESS_ID") & """ onclick=""return confirm('确认删除?');"">[删除]</a><a href=""admin_access.asp?action=MdyAccessAdmin&AccessId=" & objRSCont("ACCESS_ID") & """>[修改]</a>",strTdClass
		
		If i >= intMaxPerPage Then Exit Do
			objRSCont.MoveNext
		
	Loop

	Response.Write "<br>"
	clsTable.OutPutTable()
	Response.Write "<br>"
	Set clsTable = Nothing
	
End Sub
'============== End of ShowContentAccessAdmin() =====================
'===================================================================
'= Sub	       : ShowAcessAdmin()
'= Time		   : Created At Jun,27,2004
'= Input       : None

'= Called by   :
'= Calls       :
'= Table	   : Qurey _ACCESS
'= Description : 
'===================================================================
Sub ShowAccessAdmin()

	Dim strFileName 
	Dim intMaxPerPage
	Dim strHtmlCode
	Dim intCurPage,intTotalPut
	Dim i
	Dim intClass

	intMaxPerPage = GBL_intMaxPerAdmin
	If Not IsEmpty(Request("intPageNow")) Then
		intCurPage = Cint(Request("intPageNow"))
	Else
		intCurPage = 1
	End If
	
	clsPubDB.Clear()
	clsPubDB.TableName = "CLASS_ACCESS"
	clsPubDB.SQLType = "SELECT"
	clsPubDB.Order = "ACCESS_ID DESC"
	clsPubDB.AddField "*",""

	'== check the class user come from
	strQuery = Trim(Request("pstAddType"))
	If strQuery <> "" Then
		clsPubDB.Order = strQuery & " DESC"
		strFileName = "admin_board.asp?action=ShowAcessAdmin&pstAddType=" & strQuery
	Else
		strFileName = "admin_board.asp?action=ShowAcessAdmin"
	End If
	
	'== Get data
	clsPubDB.SQLRSExecute()
	Call ResultExecute(clsPubDB.intErrNum,"","ES_ERR")
	If Not ResultExecute(clsPubDB.intRSNum,"访问列表","ES_DB_NO") Then

		intTotalPut =  clsPubDB.intRSNum
		If intCurPage < 1 then
			  intCurPage = 1
		End If

		If (intCurPage - 1) * intMaxPerPage > intTotalPut Then
			If (intTotalPut Mod intMaxPerPage) = 0 Then
				intCurPage = intTotalPut \ intMaxPerPage
			Else
				intCurPage = intTotalPut \ intMaxPerPage + 1
			End If
		End if

		If intCurPage = 1 Then
			Call ShowContentAccessAdmin(clsPubDB.objPubRS,intMaxPerPage,intCurPage)
			Call ShowPage(intTotalPut,intMaxPerPage,intCurPage,strFileName)
		Else
			If (intCurPage - 1) * intMaxPerPage < intTotalPut Then
				clsPubDB.objPubRS.Move  (intCurPage - 1) * intMaxPerPage
				Dim BookMark
				BookMark = clsPubDB.objPubRS.BookMark
				Call ShowContentAccessAdmin(clsPubDB.objPubRS,intMaxPerPage,intCurPage)
				Call ShowPage(intTotalPut,intMaxPerPage,intCurPage,strFileName)
			Else
				intCurPage = 1
				Call ShowContentAccessAdmin(clsPubDB.objPubRS,intMaxPerPage,intCurPage)
				Call ShowPage(intTotalPut,intMaxPerPage,intCurPage,strFileName)
			End If

		End If

	End If

End Sub
'=============== End of Sub ShowAcessAdmin() =======================
'=============== FUNCTION BODY END =================================
%>