cls_main.asp第1/3页
程序员文章站
2022-03-10 14:47:13
<% class cls_main public scriptname, sqlquer...
<%
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
上一篇: asp+fso在线管理图片功能 原创
下一篇: C#的this关键字的2种用法