cls_main.asp 1th/3 page _asp class

Source: Internet
Author: User
<%
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
' Class initialization
Private Sub Class_Initialize ()
Savelog = 0 ' When set to 1, the attack or error message is logged.
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 (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

' Class end
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", "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 ()) < (* reloadtime) Then objisempty = False
End Function
Public Sub Delcahe (mycahename)
Application.Lock
Application.Contents.Remove (CacheName & "_" & Mycahename)
Application.UnLock
End Sub

' Load System configuration information
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 * 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
Current 1/3 page 123 Next read the full text

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.