📄 conn.asp
字号:
<%
startime=timer()
Set rs=server.CreateObject("ADODB.recordset")
db="c:\inetpub\wwwroot\sub.mdb"
'数据库绝对路径
conn="Provider=Microsoft.Jet.OLEDB.4.0;Data Source="&db
'数据库相对路径
'conn="Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & Server.MapPath(""&db&"")
'SQL数据连接
'conn="driver={SQL Server};server=(local);uid=sa;pwd=;database=bbs"
'数据库图片显示相对路径
picpath="../"
function strFilter(str,n)
if len(trim(str))>0 then
str=replace(str,"'","")
str=replace(str,"""","")
str=replace(str,"&","")
str=replace(str,"|","")
str=server.HTMLEncode(str)
str=replace(str,CHR(13),"")
str=replace(str,CHR(10),"")
str=replace(str,vbcrlf,"")
end if
strFilter=GetWord(str,n,"")
end function
function msgbox(error,n)
Set rs=nothing
Set conn=nothing%>
<html>
<head>
<meta http-equiv="Pragma" content="no-cache">
<meta http-equiv="Content-Language" content="zh-cn">
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
</head>
<body>
<script>
<%
if Session("msgboxtime")="" then Session("msgboxtime")=now
if DateDiff("s",Session("msgboxtime"),now())>2 then Session("msgbox")=""
if Session("msgbox")="" then
if error><"" then response.write("alert('" & error & "\n\n Copyright by 2001~2002 ZWCITY.COM');"&vbcrlf)
if Vartype(n)=2 then
if n=1 then response.write("history.go(-1);"&vbcrlf)
if n=2 then response.write("window.close();"&vbcrlf)
if n=3 then response.write("parent.top.location.href='/admin/default.asp';"&vbcrlf)
end if
if Vartype(n)=8 then response.write("window.location.href='"&n&"';")
Session("msgbox")=1
Session("msgboxtime")=now
end if
%>
</script><table width=100% height=100%><tr><td align=middle>Copyright 2001~2002 ZWCITY.COM</td></tr></table></body></html>
<%
response.end
end function
function GetLength(strChinese)
dim i, lenTotal, strWord
if strChinese = "" or vartype(strChinese) = vbNull then
GetLength = 0
exit function
end if
lenTotal = 0
for i=1 to Len(strChinese)
strWord = mid(strChinese, i, 1)
ascWord = Asc(strWord)
if ascWord < 0 or ascWord > 127 then
lenTotal = lenTotal + 2
elseif ascWord = 63 And strWord <> "?" then
lenTotal = lenTotal + 2
elseif ascWord = 44 And strWord <> "," then
lenTotal = lenTotal + 2
elseif ascWord = 33 And strWord <> "!" then
lenTotal = lenTotal + 2
else
lenTotal = lenTotal + 1
end if
next
GetLength = lenTotal
end function
function GetWord(strChinese, lenMaxWord, strTail)
dim i, lenTotal, lenWord
strChinese=trim(strChinese)
lenMaxWord=CCur(lenMaxWord)
dim strWord, bOverFlow, RetString
if strChinese = "" or vartype(strChinese) = vbNull or CLng(lenMaxWord) <= 0 then
GetWord = ""
exit function
end if
bOverFlow = False
lenTotal = 0
strTest = " "
for i=1 to Len(strChinese)
strWord = mid(strChinese, i, 1)
ascWord = Asc(strWord)
if ascWord < 0 or ascWord > 127 then
lenTotal = lenTotal + 2
elseif ascWord = 63 And strWord <> "?" then
lenTotal = lenTotal + 2
elseif ascWord = 44 And strWord <> "," then
lenTotal = lenTotal + 2
elseif ascWord = 33 And strWord <> "!" then
lenTotal = lenTotal + 2
else
lenTotal = lenTotal + 1
end if
next
if lenTotal > lenMaxWord then bOverFlow = True
if bOverFlow = True then
lenWord = 0
RetString = ""
for i=1 to Len(strChinese)
strWord = mid(strChinese, i, 1)
ascWord = Asc(strWord)
if ascWord < 0 or ascWord > 127 then
lenWord = lenWord + 2
elseif ascWord = 63 And strWord <> "?" then
lenWord = lenWord + 2
elseif ascWord = 44 And strWord <> "," then
lenWord = lenWord + 2
elseif ascWord = 33 And strWord <> "!" then
lenWord = lenWord + 2
else
lenWord = lenWord + 1
end if
if lenWord <= (lenMaxWord - Len(strTail)) then
RetString = RetString + strWord
else
GetWord = RetString + strTail
exit for
end if
next
else
GetWord = strChinese
end if
end function
function SourceData()
sql="select text,value from source"
rs.open sql,conn,1,1
if not rs.eof then
sourcearray=rs.getrows
end if
rs.close
SourceData="<select name=sourceselect onchange=""document.all.source.value=this[this.selectedIndex].value;this.selectedIndex=0""><option>来源选择"
if isarray(sourcearray) then
for i=0 to ubound(sourcearray,2)
SourceData=SourceData&"<option value="""&sourcearray(1,i)&""">"&sourcearray(0,i)
next
Set sourcearray=nothing
end if
SourceData=SourceData&"</select>"
end function
SourceSelect=SourceData()
%>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -