%@ LANGUAGE="VBScript" CodePage="936"%>
<%
'Option Explicit
Response.Buffer = True
'Blog 设置
Const blogdir = "/blog/"
Const cookies_name = "oblog313"
Const cookies_domain = ""
Const C_Editor = "/blog/editor"
Const cookies_encode = 1
Const code_gb2312 = 1
Const f_ext = "html"
Const is_sqldata = 1
Const is_ot_user = 1
const true_domain = 0
Dim str_domain : str_domain = ""
dim blogurl : blogurl = blogdir
'BBS设置
Const IsDeBug = 1
Const IsSqlDataBase = 1
Const fversion = "7.1.0 Sp1"
Const EnabledSession = True
Const MsxmlVersion = ".3.0"
'数据库设置
Const SqlDatabaseName = "ACCATrainer"
Const SqlPassword = "53830855"
Const SqlUsername = "a0117140118"
Const SqlLocalName = "(local)"
%>
<%
Response.Charset = "GB2312"
Dim Conn
Sub ConnectData()
Dim ConnStr
If IsSqlDataBase = 1 Then
ConnStr = "Provider = Sqloledb; User ID = " & SqlUsername & "; Password = " & SqlPassword & "; Initial Catalog = " & SqlDatabaseName & "; Data Source = " & SqlLocalName & ";"
Else
'ConnStr = "Provider = Microsoft.Jet.OLEDB.4.0;Data Source = " & Server.MapPath(MyDbPath & db)
End If
On Error Resume Next
Set conn = Server.CreateObject("ADODB.Connection")
conn.open ConnStr
If Err Then
err.Clear
Set Conn = Nothing
Response.Write "数据库连接出错,请检查连接字串。"'注释,需要把这几个字翻译成英文。
Response.End
End If
End Sub
Sub CloseData()
conn.close
set conn = nothing
End Sub
%>
<%
Rem 空字段则赋值为零长度字符串
Function ChkIsNull(str)
If IsNull(str) then
ChkIsNull = ""
Else
ChkIsNull = str
End If
End Function
rem *************测字符串长度**************
Function CheckStringLength(txt)
txt=trim(txt)
x = len(txt)
y = 0
for ii = 1 to x
if asc(mid(txt,ii,1)) < 0 or asc(mid(txt,ii,1)) >255 then '如果是汉字
y = y + 2
else
y = y + 1
end if
next
CheckStringLength = y
End Function
'***********************************************
'函数名:JoinChar
'作 用:向地址中加入 ? 或 &
'参 数:strUrl ----网址
'返回值:加了 ? 或 & 的网址
'***********************************************
function JoinChar(strUrl)
if strUrl="" then
JoinChar=""
exit function
end if
if InStr(strUrl,"?")
")
fString = Replace(fString, CHR(10), "
")
fString = Replace(fString, "'", "''")
HTMLEncode = fString
end if
end Function
Function ToLink(Str)
Dim RE '正则表达式对象
Dim strContent,D,I
If IsNull(Str) Then Str=""
Set RE = New RegExp '创建正则表达式对象
With RE
.Global = True '搜索应用于整个字符串
.IgnoreCase = True '搜索不区分大小写的
strContent=Str
.Pattern="([\w]*)@([\w\.]*)"
strContent=.Replace(strContent,"$1@$2 ")
D=Array("http","ftp","news","mms","https")
For I=0 To UBound(D)
.Pattern= D(I) + ":\/\/?([\w\.\/\?\&\=]*)"
strContent=.Replace(strContent,"" + D(I) + "://$1 ")
Next
End With
Set RE=Nothing
ToLink=strContent
End Function
Function ScriptFilter(sHTML)
Dim Re, sContent
sContent = chkIsNull(sHTML)
Set RE = New RegExp
With RE
.Global = True
.IgnoreCase = True
'去除Script脚本
.Pattern="?script[^>]*>"
sContent=.Replace(sContent,"")
.Pattern="(javascript|jscript|vbscript|vbs):"
sContent=.Replace(sContent,"$1:")
.Pattern="on(mouse|exit|error|click|key)"
sContent=.Replace(sContent,"removed")
'去除ActiveX
.Pattern="?object[^>]*>"
sContent=.Replace(sContent,"")
.Pattern="?param[^>]*>"
sContent=.Replace(sContent,"")
.Pattern="?embed[^>]*>"
sContent=.Replace(sContent,"")
'去除嵌入框架
.Pattern="?iframe[^>]*>"
sContent=.Replace(sContent,"")
End With
Set RE=Nothing
ScriptFilter = sContent
End Function
'*************************************
'反转换HTML代码
'*************************************
Function HTMLDecode(ByVal reString)
Dim Str:Str=reString
If Not IsNull(Str) Then
Str = Replace(Str, ">", ">")
Str = Replace(Str, "<", "<")
Str = Replace(Str, " ", CHR(9))
Str = Replace(Str, " ", CHR(9))
Str = Replace(Str, "'", CHR(39))
Str = Replace(Str, """, CHR(34))
Str = Replace(Str, "", CHR(13))
Str = Replace(Str, "
", CHR(10) & CHR(10))
Str = Replace(Str, "
", CHR(10))
HTMLDecode = Str
End If
End Function
Sub MsgBox(str,stype,url)
response.write ""
response.end
End Sub
'*************************************
'检测是否只包含英文和数字
'*************************************
Function IsValidChars(str)
Dim re,chkstr
Set re=new RegExp
re.IgnoreCase =true
re.Global=True
re.Pattern="[^_\.a-zA-Z\d]"
IsValidChars=True
chkstr=re.Replace(str,"")
if chkstr<>str then IsValidChars=False
set re=nothing
End Function
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
'*************************************
'检测是否包含在允许的字符范围
'*************************************
Function IsvalidValue(ArrayN,Str)
IsvalidValue = false
Dim GName
For Each GName in ArrayN
If Str = GName Then
IsvalidValue = true
Exit For
End If
Next
End Function
'*************************************
'检测是否有效的数字
'*************************************
Function IsInteger(Para)
IsInteger=True
If IsNull(Para) Or Trim(Para)="" Or IsNumeric(Para)=False Then
IsInteger=False
End if
End Function
'*************************************
'计算随机数
'*************************************
function randomStr(intLength)
dim strSeed,seedLength,pos,str,i
strSeed = "abcdefghijklmnopqrstuvwxyz1234567890"
seedLength=len(strSeed)
str=""
Randomize
for i=1 to intLength
str=str+mid(strSeed,int(seedLength*rnd)+1,1)
next
randomStr=str
end function
'***********************************************
'过程名:showpage
'作 用:显示“上一页 下一页”等信息
'参 数:sfilename ----链接地址
' totalnumber ----总数量
' maxperpage ----每页数量
' ShowTotal ----是否显示总数量
' ShowAllPages ---是否用下拉列表显示所有页面以供跳转。有某些页面不能使用,否则会出现JS错误。
' strUnit ----计数单位
'***********************************************
sub showpage(sfilename,totalnumber,maxperpage,ShowTotal,ShowAllPages,strUnit)
dim n, i,strTemp,strUrl
if totalnumber mod maxperpage=0 then
n= totalnumber \ maxperpage
else
n= totalnumber \ maxperpage+1
end if
strTemp= "
| " & arrErr(0) & " |
| " & arrErr(1) & " " & errmsg &" |
| << " & arrErr(2) & " |
| " & SucTitle & " |
| " & sucMsg &" |
![]() |
|
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 在线反馈 | 法律公告 | 网站地图 | 备案序号:京ICP备05057977 | 版权所有:中审(北京)国际技术培训有限公司 | |
| 西区:010-51582271(培训报名及学员事务咨询) 010-51582272(图书) 传真:51582274 东区:010-65171277/65171278 传真:65171282 |
|||
| E-mail:accatrainer@263.net.cn | |||