%
Function IsObjInstalled(strClassString)
On Error Resume Next
IsObjInstalled = False
Err = 0
Dim xTestObj
Set xTestObj = Server.CreateObject(strClassString)
If 0 = Err Then IsObjInstalled = True
Set xTestObj = Nothing
Err = 0
End Function
Sub objend()
set rSub=nothing
set rs=nothing
conn.close
set conn=nothing
endtime=timer()
response.write ""
End Sub
'函数功能:获取网站指定属性
Function GetKey(strKeyName,strUserID,strType)
strTemp=Eval(strType & "_" & strKeyName)
if strTemp="" then
GetKey="Null"
else
GetKey=strTemp
end if
End Function
'获取文件所在的用户名称
Function GetUserName()
'Get CurrFolder Name,too The user name
CurrPath=Server.MapPath( "../")
pt=InStrRev(CurrPath,"\")
CurrFolder=Right(CurrPath,len(CurrPath)-pt)
GetUserName=CurrFolder
End Function
'检查用户权限
sub checkuser(limitnum)
if Session("UserFolder")<>WebUserName then response.Redirect("/Error.asp?msg=对不起,您无权访问这个页面,有问题请与管理员联系!") : userlimits=trim(Session("AdminLimit"))
lp=instr(userlimits,limitnum)
if lp<=0 then
response.Redirect("/Error.asp?msg=对不起,您无权访问这个页面,有问题请与管理员联系!")
response.end
end if
end sub
'提示系统信息
sub ShowMsg(msg)
msg=server.URLEncode(msg) '将字符串编码,以便做参数传递
response.Redirect("/error.asp?msg=" + msg)
end sub
'判断访问来源,如果不是本部则无法访问
sub checkPrePage()
url=request.ServerVariables("HTTP_REFERER")
url=trim(replace(url,"http://",""))
url=trim(left(url,len(request.ServerVariables("SERVER_NAME"))))
if url<>trim(request.ServerVariables("server_name")) then
ShowMsg "严重警告:非法访问!
以任何方式攻击、影响本站的正常运转都是一种犯法的行为,都将承担法律责任!"
response.End()
end if
end sub
'===========================专门用来过滤Request的参数值===================================
function GetVariable(strVariableName)
if IsEmpty(Request(strVariableName)) then
GetVariable=empty
exit Function
end if
GetVariable=Replace(Request(strVariableName),"'","''")
GetVariable=Replace(GetVariable,";","")
GetVariable=Replace(GetVariable,"--","")
end function
function GetFormVariable(strVariableName)
if IsEmpty(Request.Form(strVariableName)) then
GetFormVariable=empty
exit Function
end if
GetFormVariable=Replace(Request.Form(strVariableName),"'","''")
GetFormVariable=Replace(GetFormVariable,"--","")
end function
function GetQueryString(strVariableName)
if IsEmpty(Request.QueryString(strVariableName)) then
GetQueryString=empty
exit Function
end if
GetQueryString=Replace(Request.QueryString(strVariableName),"'","''")
GetQueryString=Replace(GetQueryString,";","")
GetQueryString=Replace(GetQueryString,"--","")
end function
'===========================专门用来过滤Request的参数值===================================
'寻找第一个栏目ID号
function FirstMenu()
FirstMenu=0
End function
Function CutStr(Str,Gtype,lennum)
Dim p_num
Dim i,x
If strlen(Str)<=lennum Then
CutStr=str
Else
p_num=0
x=0
Do while not p_num > lennum-2
x=x+1
If asc(mid(str,x,1))<0 Then
p_num=int(p_num) + 2
Else
p_num=int(p_num) + 1
End If
If Gtype = 1 Then
CutStr=left(trim(str),x) & "..."
Else
CutStr="..." & Right(trim(str),x)
End IF
Loop
End If
End Function
'取字符串长度
Function strlen(str)
Dim p_len,xx
p_len=0
strlen=0
If trim(str)<>"" Then
p_len=len(trim(str))
For xx=1 to p_len
If asc(mid(str,xx,1))<0 Then
strlen=clng(strlen) + 2
Else
strlen=clng(strlen) + 1
End If
Next
End If
End Function
function convert_old(str)
dim tempStr
tempStr = str&""
if tempStr = "" then
tempStr = " "
else
tempStr=replace(tempStr,"'","’")
tempStr=replace(tempStr,"""",""")
tempStr=replace(tempStr," "," ")
tempStr=replace(tempStr,"<","<")
tempStr=replace(tempStr,">",">")
tempStr=replace(tempStr,chr(13),"
")
end if
convert=tempStr
End function
function convert(str)
dim re
dim restr
reStr = str&""
Set re=new RegExp
re.IgnoreCase =true
re.Global=True
re.Pattern = "<"
restr = re.replace(restr,"<")
re.Pattern = "<(.*?)>"
'restr = re.replace(restr,"")
re.Pattern = " "
restr = re.replace(restr," ")
re.Pattern = "\n"
restr = re.replace(restr,"
")
convert = restr
end function
%>