\'定义全局变量
Dim ConnStr
Dim objConn
Dim objRS
Dim strSQL
Dim StarTime
Dim EndTime
StarTime = Timer()
\'*********************************************************
\' 目的: System 初始化
\'*********************************************************
Sub System_Initialize()
If OpenConnect=False Then
Call OpenConnect()
If Err Then
err.Clear
Call System_Terminate()
Call ShowError(\"Database Conecting Error.\",\"/\")
End If
End If
End Sub
\'*********************************************************
\'*********************************************************
\' 目的: System 释放
\'*********************************************************
Sub System_Terminate()
Call CloseConnect()
End Sub
\'*********************************************************
\'*********************************************************
\' 目的: 数据库连接
\'*********************************************************
Function OpenConnect()
ConnStr = \"Provider = Sqloledb; User ID = \" & SqlUsername & \"; Password = \" & SqlPassword & \"; Initial Catalog = \" & SqlDatabaseName & \"; Data Source = \" & SqlLocalName & \";\"
Set objConn = Server.CreateObject(\"ADODB.Connection\")
objConn.Open ConnStr
OpenConnect=True
End Function
\'*********************************************************
\'*********************************************************
\' 目的: DB Disable Connect
\'*********************************************************
Function CloseConnect()
objConn.Close
Set objConn = Nothing
End Function
\'*********************************************************
\'*********************************************************
\' 目的: 时间计长
\'*********************************************************
Function RunTime()
EndTime=Timer()
RunTime = CLng(FormatNumber((EndTime-StarTime)*1000,3))
End Function
\'*********************************************************
\'*********************************************************
\' 目的: 错误打印
\'*********************************************************
Sub ShowError(str,url)
Response.Write \"<div style=\"\"font-size:14px; font-family:tahoma; border:1px #84ACE7 solid; background:#ECF1FB; padding:9px 7px 7px 9px;\"\"><b>Info:</b><BR /> \"& str &\" <BR /><BR /><a href=\"\"javascript:window.location=\'\"& url &\"\'\"\">[返回]</a></div>\"
Response.End
End Sub
Sub BackError(str)
Response.Write \"<div style=\"\"font-size:14px; font-family:tahoma; border:1px #84ACE7 solid; background:#ECF1FB; padding:9px 7px 7px 9px;\"\"><b>Info:</b><BR /> \"& str &\" <BR /><BR /><a href=\"\"javascript:history.go(-1);\"\">[返回]</a></div>\"
Response.End
End Sub
\'*********************************************************
\'*********************************************************
\' 目的: 检查登陆
\'*********************************************************
Function CheckLogin()
If CheckPostUrl = False Then
Call ShowError(\"禁止站外恶意提交数据!\",\"index.asp\")
End If
Dim AdminName,AdminClass,Sql,Rs
AdminName = session(\"AdminName\")
AdminClass = session(\"AdminClass\")
If Len(AdminName) < 1 then
Call ShowError(\"尚未登陆或者登陆超时,请返回登陆页面!\",\"index.asp\")
End If
Sql=\"select top 1 AdminID from c_Admin Where AdminName=\'\"& AdminName &\"\' and AdminClass=\'\"& AdminClass &\"\'\"
Set Rs=objConn.Execute(Sql)
If Rs.eof And Rs.bof Then
Call System_Terminate()
session(\"AdminName\") = \"\"
session(\"AdminClass\") = \"\"
Call ShowError(\"登陆信息有误!\",\"index.asp\")
End If
End Function
\'*********************************************************