www.gusucode.com > CC校友录贴吧 CCBar源码程序asp编程 > inc/inc_action.asp
<!-- #include file = "../class/class_exception.asp" --> <% '=================================================================== '= ASP FILENAME : /inc/inc_action.asp '= CREATED TIME : 2006-4-17 11:10 '= LAST MODIFIED: 2006-4-17 11:10 '= VERSION INFO : CCASP Framework Ver 2.0.1 ALL RIGHTS RESERVED BY www.cclinux.com '= DESCRIPTION : Action处理 '= Change Log: '=================================================================== '==================================================================== '= Function : ActionFilter '= Time : Created At 2206/05/02 '= Input : '= Description : 用户请求校验与分拣 '=================================================================== Function ActionFilter(strPageName,Action) End Function '==================================================================== '= Function : ResultExecute(intResultId,strAddInfo,strExecMode) '= Time : Created At 2006-5-3 '= Input : intResultId : the error number '= strAddInfo : the add error information '= strExecMode : the mode of execute err or succ '= "ES_DB_NO" -- show error info directly of db '= "ES_DB_YES" -- redirect err.asp of db '= "ES_ERR" -- only deal with error '= "ES_SUCC" -- only deal with success '= "ES_NORMAL" -- deal with error or succ '= Description : 错误或成功信息格式化处理 '=================================================================== Function ResultExecute(intResultId,strAddInfo,strExecMode) Dim strActMode ResultExecute = False '== Initial result of execute is false '== 错误调试模式 If CTL_ERROR_DEBUG Then Exit Function End If Select Case strExecMode Case "ES_DB_NO": If intResultId = 0 Then ResultExecute = True Response.Write "<br><p align=center> 本栏目: " & strAddInfo & "记录不存在</p>" End If Case "ES_DB_YES": If intResultId = 0 Then Call ActionClear() Response.Redirect GBL_strHomeURL & GBL_strErrPage & "?intErrId=1003" & "&strAddInfo=" & strAddInfo & strActMode End If Case "ES_SUCCESS" : If intResultId <> 0 Then Call ActionClear() Response.Redirect GBL_strHomeURL & GBL_strSuccPage & "?intSuccId=" & intResultId & "&strAddInfo=" & strAddInfo End If Case "ES_SUCC_NO": If intResultId = 0 Then ResultExecute = True Response.Write "<br><p align=center> 本栏目: " & strAddInfo & "</p>" End If Case "ES_ERR" : If intResultId <> 0 Then Call ActionClear() Response.Redirect GBL_strHomeURL & GBL_strErrPage & "?intErrId=" & intResultId & "&strAddInfo=" & strAddInfo & "&pstNowPost=" & Trim(Request.QueryString("action")) & strActMode End If Case "ES_NORMAL" : If intResultId <> 0 Then Call ActionClear() Response.Redirect GBL_strHomeUrl & GBL_strErrPage & "?intErrId=" & intResultId & "&strAddInfo=" & strAddInfo & strActMode Else Call ActionClear() Response.Redirect GBL_strHomeUrl & GBL_strSuccPage & "?intSuccId=" & intResultId & "&strAddInfo=" & strAddInfo & strActMode End If Case Else : Call ActionClear() Response.Redirect GBL_strHomeUrl & GBL_strErrPage & "?intErrId=14&strAddInfo=" & strExecMode & strActMode End Select End Function '=================================================================== '= Function : ExceptionExecute() '= Time : Created At 2006-5-3 '= Input : None '= Description : 异常流处理(跳转到错误页面显示) '=================================================================== Function ExceptionExecute() Call ResultExecute(GBL_objException.getErrId(),GBL_objException.getErrInfo(),"ES_ERR") End Function '=================================================================== '= Function : SuccExecute() '= Time : Created At 2006-5-3 '= Input : None '= Description : 成功流处理(跳转到成功页面显示) '=================================================================== Function SuccExecute(succInfo,succUrl) Dim strAlert If GBL_intSuccType = 1 Then '== 成功页面 If Trim(succUrl) <> "" Then Session(GBL_strCookieURL & "SEN_succUrl") = succUrl End If Call ResultExecute("200",succInfo,"ES_SUCCESS") ElseIf GBL_intSuccType = 2 Then '== 弹出窗口 Call ActionClear() strAlert = "<script language=""JavaScript"" type=""text/JavaScript"">alert(""" & succInfo & """);window.location.href=""" & GBL_strHomeUrl & succUrl & """;</script>" Response.Write strAlert Response.end Else '== 本页提示 Call ActionClear() Response.Redirect GBL_strHomeURL & succUrl & "&succInfo=" & succInfo Response.end End If End Function '=================================================================== '= Function : ActionAuThenCheck(intAuThen) '= Time : Created At 2006-5-3 '= Input : None '= Description : 用户访问权限校验 '=================================================================== Function ActionAuThenCheck(intAuThen) Dim intAuthenNow Dim strUser,strPwd strUser = Trim(Request.Cookies(GBL_strCookieURL)("user")) strPwd = Trim(Request.Cookies(GBL_strCookieURL)("pass")) If Not IsEmpty(Session(GBL_strCookieURL & "SEN_strUserAuThen")) Then If IsNumeric(Session(GBL_strCookieURL & "SEN_strUserAuThen")) Then intAuthenNow = Cint(Session(GBL_strCookieURL & "SEN_strUserAuThen")) Else intAuthenNow = -1 End If Else intAuthenNow = -1 End If '== open for all (include guest) If intAuThen = 9 Then If CONST_PAGE_FILE = "user/user_login_form.asp" Or CONST_PAGE_FILE = "user/user_announce.asp" Or CONST_PAGE_FILE = "user/user_reg_form.asp" Then Exit Function End If '== check cookie exsit If (Not IsEmpty(strUser)) And _ (strUser <> "") And _ Not IsEmpty(strPwd) And _ (strPwd <> "") And _ (IsEmpty(Session(GBL_strCookieURL & "SEN_UserId")) Or _ Session(GBL_strCookieURL & "SEN_UserId") = "") _ Then If CheckPass(strUser,strPwd,1) Then Set GBL_objPubDB = Nothing Response.Redirect GBL_strHomeUrl & "user/user_info_show.asp?action=ShowUserAllInfo" Exit Function Else '== destory cookie Response.Cookies(GBL_strCookieURL)("user") = "" Response.Cookies(GBL_strCookieURL)("pass") = "" Response.Cookies(GBL_strCookieURL).Expires = Date - 1 Set GBL_objPubDB = Nothing Response.Redirect GBL_strHomeUrl & "user/user_login_form.asp?action=FormUserLogin" Exit Function End If Else Exit Function End If End If '== check the comm user If IsEmpty(Session(GBL_strCookieURL & "SEN_strUserRealName")) Or _ IsEmpty(Session(GBL_strCookieURL & "SEN_UserId")) Or _ IsEmpty(Session(GBL_strCookieURL & "SEN_strUserAccount")) Or _ Session(GBL_strCookieURL & "SEN_strUserRealName") = "" Or _ Session(GBL_strCookieURL & "SEN_UserId") = "" Or _ Session(GBL_strCookieURL & "SEN_strUserAccount") = "" Then If CheckPass(strUser,strPwd,1) Then Set GBL_objPubDB = Nothing Response.Redirect GBL_strHomeUrl & "user/user_info_show.asp?action=ShowUserAllInfo" Exit Function Else Set GBL_objPubDB = Nothing Response.Redirect GBL_strHomeUrl & "user/user_login_form.asp?action=FormUserLogin" Exit Function End If End If '== check the administrator If intAuThen = 1 Then If intAuthenNow <> intAuThen Then Call ResultExecute(18,"管理员权限","ES_ERR") Exit Function End If End If End Function '=================================================================== '= Function : ActionView '= Time : Created At 2006-4-19 '= Description : 有页面显示的请求 '=================================================================== Function ActionView(Action) '== 执行 Execute Action & "()" '== 异常处理 Call ExceptionExecute() End Function '=================================================================== '= Function : ActionExecute '= Time : Created At 2006-4-19 '= Description : 非页面显示请求 '=================================================================== Function ActionExecute(Action) '== 执行 Execute Action & "()" '== 异常处理 Call ExceptionExecute() End Function '=================================================================== '= Function : ActionBuild '= Time : Created At 2006-4-19 '= Description : 页面开始初始化工作 '=================================================================== Function ActionBuild() '== 创建数据库操作类实例 If Not IsObject(GBL_objPubDB) Then Set GBL_objPubDB = New classDBOprt End If '== 创建异常类实例 If Not IsObject(GBL_objException) Then Set GBL_objException = New Exception End If '== 创建表单数据对象实例 If Not IsObject(GBL_objFormData) Then Set GBL_objFormData = CreateObject("Scripting.Dictionary") End If End Function '=================================================================== '= Function : ActionOver '= Time : Created At 2006-4-19 '= Description : 页面结束清除工作 '=================================================================== Function ActionOver() '== 捕捉异常 Call ExceptionExecute() '== 资源释放 Call ActionClear() '== 页面结束 'Response.End End Function '=================================================================== '= Function : ActionClear() '= Time : Created At 2006-5-3 '= Description : 处理结束后资源清除工作 '=================================================================== Function ActionClear() '== 开发调试信息 Call SiteFooter() '== 释放数据库连接 If IsObject(GBL_objPubDB) Then Set GBL_objPubDB = Nothing End If '== 清除异常类实例 If IsObject(GBL_objException) Then Set GBL_objException = Nothing End If '== 清除表单数据对象实例 If IsObject(GBL_objFormData) Then Set GBL_objFormData = Nothing End If End Function '=================================================================== '= Function : SiteFooter '= Time : Created At 2006-5-3 '= Description : 页面调试信息(数据库调试,环境变量调试,错误调试) '=================================================================== Function SiteFooter() '== DB Debug If CTL_DB_DEBUG Then Call ShowDBDebug(GBL_objPubDB) End If '== Error Debug If CTL_ERROR_DEBUG Then Call ShowErrorDebug() End If '== ENV Debug If CTL_ENV_DEBUG Then Call ShowEnv() End If End Function '== 页面模块加载 Function LoadPageTpl() Response.Write "您尚未设置页面加载模板" End Function '=================================================================== '= Function : CheckObjInstalled(strClassString,ByRef strClew) '= Time : Created At DEC,28,2003 '= Input : strClassString : obj name '= Return : installed or not flag '= Description : check obj is or not installed '=================================================================== Function CheckObjInstalled(strClassString,ByRef strClew) On Error Resume Next Dim intInstallFlag Err = 0 Dim objTmp Set objTmp = Server.CreateObject(strClassString) intInstallFlag = Err If intInstallFlag = 0 Then CheckObjInstalled = True strClew = "支持此组件" ElseIf intInstallFlag = -2147221005 Then strClew = "组件未安装" CheckObjInstalled = False ElseIf intInstallFlag = -2147221477 Then strClew = "支持此组件" CheckObjInstalled = True ElseIf intInstallFlag = 1 Then strClew = "未知的错误,组件可能未正确安装" CheckObjInstalled = False End If Err.Clear Set objTmp = Nothing Err = 0 End Function %>