cls_main.asp第1/3页
编程学习 2021-07-05 10:58www.dzhlxh.cn编程入门
<%
class cls_main
Public ScriptName, SqlQueryNum, savelog, system, ResLicence, ResType, ResLanguage, UserClass, strMsg, RefererPage
Public adminName, adminPass, System_Sn, UserTrueIP
Public Reloadtime, MaxCount, CacheName, Cache_Data, sPath
Private LocalCacheName, CacheData, DelCount, ArrSetting
Public MemberUserName, MemberUserID, MemberUserPassword, MemberUserClass, MemberVipType
'类初始化
Private Sub Class_Initialize()
savelog = 0 '设置为1的时候会记录攻击或错误错信息。
SqlQueryNum = 0
Dim Tmpstr, i
Tmpstr = Request.ServerVariables("PATH_INFO")
Tmpstr = Split(Tmpstr, "/")
i = UBound(Tmpstr)
ScriptName = LCase(Tmpstr(i))
RefererPage = Request.ServerVariables("HTTP_REFERER")
adminName = Session("adminName")
adminPass = Session("adminPass")
Reloadtime = 14400
CacheName = Replace(Replace(Replace(Server.MapPath("index.asp"), "index.asp", ""), ":", ""), "\", "")
System_Sn = LCase(Replace(Request.ServerVariables("SERVER_NAME") & Request.ServerVariables("URL"), Split(Request.ServerVariables("SCRIPT_NAME"), "/")(UBound(Split(Request.ServerVariables("SCRIPT_NAME"), "/"))), ""))
UserTrueIP = Request.ServerVariables("HTTP_X_FORWARDED_FOR")
If UserTrueIP = "" Then UserTrueIP = Request.ServerVariables("REMOTE_ADDR")
UserTrueIP = checkStr(UserTrueIP)
If SystemEdition = 3 Then
sPath = "../"
Else
sPath = ""
End If
MemberUserName = checkStr(Request.Cookies(System_Sn)("MemberUserName"))
MemberUserID = checkStr(Request.Cookies(System_Sn)("MemberUserID"))
MemberUserPassword = checkStr(Request.Cookies(System_Sn)("MemberUserPassword"))
MemberUserClass = checkStr(Request.Cookies(System_Sn)("MemberUserClass"))
MemberVipType = checkStr(Request.Cookies(System_Sn)("MemberVipType"))
End Sub
'类结束
Private Sub Class_Terminate()
If IsObject(Conn) Then
'Conn.Close
Set Conn = Nothing
End If
End Sub
Public Property Let Name(ByVal vNewValue)
LocalCacheName = LCase(vNewValue)
End Property
Public Property Let Value(ByVal vNewValue)
If LocalCacheName <> "" Then
ReDim Cache_Data(2)
Cache_Data(0) = vNewValue
Cache_Data(1) = Now()
Application.Lock
Application(CacheName & "_" & LocalCacheName) = Cache_Data
Application.UnLock
Else
Err.Raise vbObjectError + 1, "Mesky.Cn CacheServer", " please change the CacheName."
End If
End Property
Public Property Get Value()
If LocalCacheName <> "" Then
Cache_Data = Application(CacheName & "_" & LocalCacheName)
If IsArray(Cache_Data) Then
Value = Cache_Data(0)
Else
Err.Raise vbObjectError + 1, "Mesky.Cn CacheServer", " The Cache_Data(" & LocalCacheName & ") Is Empty."
End If
Else
Err.Raise vbObjectError + 1, "Mesky.Cn CacheServer", " please change the CacheName."
End If
End Property
Public Function ObjIsEmpty()
ObjIsEmpty = True
Cache_Data = Application(CacheName & "_" & LocalCacheName)
If Not IsArray(Cache_Data) Then Exit Function
If Not IsDate(Cache_Data(1)) Then Exit Function
If DateDiff("s", CDate(Cache_Data(1)), Now()) < (60 * Reloadtime) Then ObjIsEmpty = False
End Function
Public Sub DelCahe(MyCaheName)
Application.Lock
Application.Contents.Remove (CacheName & "_" & MyCaheName)
Application.UnLock
End Sub
'加载系统配置信息
Public Sub LoadSetting()
Dim Rs
'If Not IsObject(Conn) Then ConnectionDatabase
Set Rs = Execute("Select Setting From Mesky_Setting where isDefault=1")
ArrSetting = Split(Rs("Setting"), "{$}")
Set Rs = Nothing
system = Split(ArrSetting(144), ",")
ResLicence = Split(ArrSetting(141), ",")
ResLanguage = Split(ArrSetting(142), ",")
ResType = Split(ArrSetting(143), ",")
UserClass = Split(ArrSetting(140), ",")
Name = "StyleName"
If ObjIsEmpty Then Call ReloadTemplates
End Sub
Public Function Setting(s)
Setting = ArrSetting(s)
End Function
Public Sub ReloadTemplates()
Dim Rs, i
Set Rs = Execute("select top 1 * from Mesky_Style where isDefault =1")
If Not (Rs.EOF And Rs.BOF) Then
For i = 2 To Rs.Fields.Count - 3
Name = Rs(i).Name
'Response.Write(Rs(i).Name)
Value = Rs(i).Value
Next
End If
Set Rs = Nothing
End Sub
class cls_main
Public ScriptName, SqlQueryNum, savelog, system, ResLicence, ResType, ResLanguage, UserClass, strMsg, RefererPage
Public adminName, adminPass, System_Sn, UserTrueIP
Public Reloadtime, MaxCount, CacheName, Cache_Data, sPath
Private LocalCacheName, CacheData, DelCount, ArrSetting
Public MemberUserName, MemberUserID, MemberUserPassword, MemberUserClass, MemberVipType
'类初始化
Private Sub Class_Initialize()
savelog = 0 '设置为1的时候会记录攻击或错误错信息。
SqlQueryNum = 0
Dim Tmpstr, i
Tmpstr = Request.ServerVariables("PATH_INFO")
Tmpstr = Split(Tmpstr, "/")
i = UBound(Tmpstr)
ScriptName = LCase(Tmpstr(i))
RefererPage = Request.ServerVariables("HTTP_REFERER")
adminName = Session("adminName")
adminPass = Session("adminPass")
Reloadtime = 14400
CacheName = Replace(Replace(Replace(Server.MapPath("index.asp"), "index.asp", ""), ":", ""), "\", "")
System_Sn = LCase(Replace(Request.ServerVariables("SERVER_NAME") & Request.ServerVariables("URL"), Split(Request.ServerVariables("SCRIPT_NAME"), "/")(UBound(Split(Request.ServerVariables("SCRIPT_NAME"), "/"))), ""))
UserTrueIP = Request.ServerVariables("HTTP_X_FORWARDED_FOR")
If UserTrueIP = "" Then UserTrueIP = Request.ServerVariables("REMOTE_ADDR")
UserTrueIP = checkStr(UserTrueIP)
If SystemEdition = 3 Then
sPath = "../"
Else
sPath = ""
End If
MemberUserName = checkStr(Request.Cookies(System_Sn)("MemberUserName"))
MemberUserID = checkStr(Request.Cookies(System_Sn)("MemberUserID"))
MemberUserPassword = checkStr(Request.Cookies(System_Sn)("MemberUserPassword"))
MemberUserClass = checkStr(Request.Cookies(System_Sn)("MemberUserClass"))
MemberVipType = checkStr(Request.Cookies(System_Sn)("MemberVipType"))
End Sub
'类结束
Private Sub Class_Terminate()
If IsObject(Conn) Then
'Conn.Close
Set Conn = Nothing
End If
End Sub
Public Property Let Name(ByVal vNewValue)
LocalCacheName = LCase(vNewValue)
End Property
Public Property Let Value(ByVal vNewValue)
If LocalCacheName <> "" Then
ReDim Cache_Data(2)
Cache_Data(0) = vNewValue
Cache_Data(1) = Now()
Application.Lock
Application(CacheName & "_" & LocalCacheName) = Cache_Data
Application.UnLock
Else
Err.Raise vbObjectError + 1, "Mesky.Cn CacheServer", " please change the CacheName."
End If
End Property
Public Property Get Value()
If LocalCacheName <> "" Then
Cache_Data = Application(CacheName & "_" & LocalCacheName)
If IsArray(Cache_Data) Then
Value = Cache_Data(0)
Else
Err.Raise vbObjectError + 1, "Mesky.Cn CacheServer", " The Cache_Data(" & LocalCacheName & ") Is Empty."
End If
Else
Err.Raise vbObjectError + 1, "Mesky.Cn CacheServer", " please change the CacheName."
End If
End Property
Public Function ObjIsEmpty()
ObjIsEmpty = True
Cache_Data = Application(CacheName & "_" & LocalCacheName)
If Not IsArray(Cache_Data) Then Exit Function
If Not IsDate(Cache_Data(1)) Then Exit Function
If DateDiff("s", CDate(Cache_Data(1)), Now()) < (60 * Reloadtime) Then ObjIsEmpty = False
End Function
Public Sub DelCahe(MyCaheName)
Application.Lock
Application.Contents.Remove (CacheName & "_" & MyCaheName)
Application.UnLock
End Sub
'加载系统配置信息
Public Sub LoadSetting()
Dim Rs
'If Not IsObject(Conn) Then ConnectionDatabase
Set Rs = Execute("Select Setting From Mesky_Setting where isDefault=1")
ArrSetting = Split(Rs("Setting"), "{$}")
Set Rs = Nothing
system = Split(ArrSetting(144), ",")
ResLicence = Split(ArrSetting(141), ",")
ResLanguage = Split(ArrSetting(142), ",")
ResType = Split(ArrSetting(143), ",")
UserClass = Split(ArrSetting(140), ",")
Name = "StyleName"
If ObjIsEmpty Then Call ReloadTemplates
End Sub
Public Function Setting(s)
Setting = ArrSetting(s)
End Function
Public Sub ReloadTemplates()
Dim Rs, i
Set Rs = Execute("select top 1 * from Mesky_Style where isDefault =1")
If Not (Rs.EOF And Rs.BOF) Then
For i = 2 To Rs.Fields.Count - 3
Name = Rs(i).Name
'Response.Write(Rs(i).Name)
Value = Rs(i).Value
Next
End If
Set Rs = Nothing
End Sub
1
上一篇:数据库记录的删除,delete好还是update好?
下一篇:MusicGet 类