<button id="nc8ni"><xmp id="nc8ni"><button id="nc8ni"></button><ins id="nc8ni"><button id="nc8ni"><form id="nc8ni"></form></button></ins>
<button id="nc8ni"><form id="nc8ni"></form></button>
<form id="nc8ni"><xmp id="nc8ni">
<ins id="nc8ni"><button id="nc8ni"></button></ins>
<button id="nc8ni"><xmp id="nc8ni">
<ins id="nc8ni"><form id="nc8ni"><ins id="nc8ni"></ins></form></ins>
<button id="nc8ni"><xmp id="nc8ni">
<button id="nc8ni"><xmp id="nc8ni">
<button id="nc8ni"><form id="nc8ni"><ins id="nc8ni"></ins></form></button><button id="nc8ni"><form id="nc8ni"></form></button>
<button id="nc8ni"><form id="nc8ni"><ins id="nc8ni"></ins></form></button><button id="nc8ni"><xmp id="nc8ni"><button id="nc8ni"></button><form id="nc8ni"><ins id="nc8ni"><form id="nc8ni"></form></ins></form><button id="nc8ni"><xmp id="nc8ni"><ins id="nc8ni"></ins>
<button id="nc8ni"><xmp id="nc8ni"><ins id="nc8ni"></ins><form id="nc8ni"><ins id="nc8ni"><form id="nc8ni"></form></ins></form>
<ins id="nc8ni"><form id="nc8ni"></form></ins>
<button id="nc8ni"><form id="nc8ni"><ins id="nc8ni"></ins></form></button>
<button id="nc8ni"></button>
<button id="nc8ni"></button>
訂閱本欄目 RSS您所在的位置: 深山工作室 > ASP > 正文

ASP過(guò)濾SQL中的非法字符并格式化相關(guān)的html代碼

天極網(wǎng) 2008/3/15 20:34:15 深山行者 字體: 瀏覽 8233

 

 

以下是引用片段:

<%
function changechr(str)
changechr=replace(replace(replace(replace(str,"<","&lt;"),">","&gt;"),chr(13),"<br>")," ","&nbsp;")
changechr=replace(replace(replace(replace(changechr,"[sayyes]","<div align=center><img src="),"[b]","<b>"),"[red]","<font color=CC0000>"),"[big]","<font size=7>")
changechr=replace(replace(replace(replace(changechr,"[/sayyes]","></img></div>"),"[/b]","</b>"),"[/red]","</font>"),"[/big]","</font>")
end function

'過(guò)濾SQL非法字符并格式化html代碼
function Replace_Text(fString)
if isnull(fString) then
Replace_Text=""
exit function
else
fString=trim(fString)
fString=replace(fString,"'","''")
fString=replace(fString,";",";")
fString=replace(fString,"--","—")
fString=server.htmlencode(fString)
Replace_Text=fString
end if
end function

'會(huì )員發(fā)布的各種信息過(guò)濾
'Function Replace_Text(fString)
'If Not IsNull(fString) Then
'fString = trim(fString)
'fString = replace(fString, ";", ";")     '分號過(guò)濾
'fString = replace(fString, "--", "——") '--過(guò)濾
'fString = replace(fString, "%20", "")    '特殊字符過(guò)濾
'fString = replace(fString, "==", "")     '==過(guò)濾
'fString = replace(fString, ">", "&gt;")
'fString = replace(fString, "<", "&lt;")
'fString = Replace(fString, CHR(32), " ")   '&nbsp;
'fString = Replace(fString, CHR(9), " ")    '&nbsp;
'fString = Replace(fString, CHR(34), "&quot;")
'fString = Replace(fString, CHR(39), "&#39;") '單引號過(guò)濾
'fString = Replace(fString, CHR(13), "")
'fString = Replace(fString, CHR(10) & CHR(10), "</P><P> ")
'fString = Replace(fString, CHR(10), "<BR> ")
'Replace_Text = fString
'End If
'End Function

'過(guò)濾SQL非法字符
Function checkStr(Chkstr)
dim Str:Str=Chkstr
if isnull(Str) then
   checkStr = ""
   exit Function
else
   Str=replace(Str,"'","")
   Str=replace(Str,";","")
   Str=replace(Str,"--","")
   checkStr=Str
end if
End Function

'檢測傳遞的參數是否為數字型
Function Chkrequest(Para)
Chkrequest=False
If Not (IsNull(Para) Or Trim(Para)="" Or Not IsNumeric(Para)) Then
    Chkrequest=True
End If
End Function

'檢測傳遞的參數是否為日期型
Function Chkrequestdate(Para)
Chkrequestdate=False
If Not (IsNull(Para) Or Trim(Para)="" Or Not IsDate(Para)) Then
    Chkrequestdate=True
End If
End Function

'得到當前頁(yè)面的地址
Function GetUrl()
On Error Resume Next
Dim strTemp
If LCase(Request.ServerVariables("HTTPS")) = "off" Then
strTemp = "http://"
Else
strTemp = "https://"
End If
strTemp = strTemp & CheckStr(Request.ServerVariables("SERVER_NAME"))
If Request.ServerVariables("SERVER_PORT") <> 80 Then strTemp = strTemp & ":" & CheckStr(Request.ServerVariables("SERVER_PORT"))
strTemp = strTemp & CheckStr(Request.ServerVariables("URL"))
If Trim(Request.QueryString) <> "" Then strTemp = strTemp & "?" & CheckStr(Trim(Request.QueryString))
GetUrl = strTemp 
End Function

'Function CheckReferer()   '檢查用戶(hù)是否在瀏覽器里輸入了本頁(yè)的地址
'     Dim sReferer, Icheck
'     CheckReferer = True
'     sReferer = Request.ServerVariables("HTTP_REFERER")
'     ServerIP = Request.ServerVariables("LOCAL_ADDR")
'     Icheck = InStr(sReferer, "ServerIP")
'     If Icheck = 0 Then
'     CheckReferer = False
'     End If
'End Function

'日期格式化
Function FormatDate(DT,tp)
dim Y,M,D
Y=Year(DT)
M=month(DT)
D=Day(DT)
if M<10 then M="0"&M
if D<10 then D="0"&D
select case tp
case 1 FormatDate=Y&"年"&M&"月"&D&"日"
case 2 FormatDate=Y&"-"&M&"-"&D
end select
End Function

'不允許外部提交數據的選擇
Function ChkPost()
     dim HTTP_REFERER,SERVER_NAME
dim server_v1,server_v2
chkpost=false
     SERVER_NAME=CheckStr(Request.ServerVariables("SERVER_NAME"))
HTTP_REFERER=CheckStr(Request.ServerVariables("HTTP_REFERER"))
server_v1=Cstr(HTTP_REFERER)
server_v2=Cstr(SERVER_NAME)
if mid(server_v1,8,len(server_v2))<>server_v2 then
   chkpost=false
else
   chkpost=true
end if
End Function

'構造上傳圖片文件名隨機數
function MakedownName()
dim fname
fname = now()
fname = replace(fname,"-","")
fname = replace(fname," ","")
fname = replace(fname,":","")
fname = replace(fname,"PM","")
fname = replace(fname,"AM","")
fname = replace(fname,"上午","")
fname = replace(fname,"下午","")
fname = int(fname) + int((10-1+1)*Rnd + 1)
MakedownName=fname
end function

'Email檢測
function IsValidEmail(email)
dim names, name, i, c
IsValidEmail = true
names = Split(email, "@")
if UBound(names) <> 1 then
    IsValidEmail = false
    exit function
end if
for each name in names
    if Len(name) <= 0 then
      IsValidEmail = false
      exit function
    end if
    for i = 1 to Len(name)
      c = Lcase(Mid(name, i, 1))
      if InStr("abcdefghijklmnopqrstuvwxyz_-.", c) <= 0 and not IsNumeric(c) then
        IsValidEmail = false
        exit function
      end if
    next
    if Left(name, 1) = "." or Right(name, 1) = "." then
       IsValidEmail = false
       exit function
    end if
next
if InStr(names(1), ".") <= 0 then
    IsValidEmail = false
    exit function
end if
i = Len(names(1)) - InStrRev(names(1), ".")
if i <> 2 and i <> 3 then
    IsValidEmail = false
    exit function
end if
if InStr(email, "..") > 0 then
    IsValidEmail = false
end if
end function

'Jmail郵件發(fā)送
Function SendJmail(Email,Topic,MailBody)

Dim JMail
on error resume next
Set JMail = Server.CreateObject("JMail.SMTPMail")
JMail.LazySend             = true
JMail.silent             = true
JMail.Charset             = "gb2312"
JMail.ContentType       = "text/html"
JMail.Sender             = "wemaster@alibaba.info" '我們網(wǎng)站自己的郵箱
JMail.ReplyTo             = "wemaster@alibaba.info" '我們網(wǎng)站自己的郵箱
JMail.SenderName       = "阿里爸爸郵件發(fā)送"
JMail.Subject             = Topic
JMail.SimpleLayout       = true
JMail.Body             = MailBody
JMail.Priority             = 3
JMail.AddRecipient Email
JMail.AddHeader "Originating-IP", GBL_IPAddress
If JMail.Execute() = false Then
   SendJmail = 0
Else
   SendJmail = 1
End If
JMail.Close
Set JMail = Nothing

End Function

'分頁(yè)
Function listPages(LinkFile)
    if not (rs.eof and rs.bof) then
gopage=currentpage
totalpage=n
blockPage=Int((gopage-1)/10)*10+1
' if instr(linkfile,"?page=")>0 or instr(linkfile,"&page=")>0 then
' pos=instr(linkfile,"page=")-2
' linkfile=left(linkfile,pos)
' end if

If LCase(Request.ServerVariables("HTTPS")) = "off" Then
     strTemp = "http://"
     Else
     strTemp = "https://"
     End If
     strTemp = strTemp & CheckStr(Request.ServerVariables("SERVER_NAME"))
     If Request.ServerVariables("SERVER_PORT") <> 80 Then strTemp = strTemp & ":" & CheckStr(Request.ServerVariables("SERVER_PORT"))
     strTemp = strTemp & CheckStr(Request.ServerVariables("URL"))
     lenstrTemp=len(strTemp)+1
if instr(left(linkfile,lenstrTemp),"?")>0 then

if blockPage = 1 Then
   Response.Write "<span disabled>【←前10頁(yè)</span>&nbsp;"
Else
   Response.Write("<span disabled>【</span><a href=" & LinkFile & "&page="&blockPage-10&">←前10頁(yè)</a>&nbsp;")
End If
    i=1
    Do Until i > 10 or blockPage > n
     If blockPage=int(gopage) Then
   Response.Write("<font color=#FF0000>[<b>"&blockPage&"</b>]</font>")
Else
   Response.Write(" <a href=" & LinkFile & "&page="&blockPage&">["&blockPage&"]</a> ")
     End If
     blockPage=blockPage+1
     i = i + 1
     Loop
if blockPage > totalpage Then
   Response.Write "&nbsp;<span disabled>后10頁(yè)→】"
Else
   Response.Write("&nbsp;<a href=" & LinkFile & "&page="&blockPage&">后10頁(yè)→</a><span disabled>】")
End If
response.write" 直接到第 "
response.write"<select onchange=if(this.options[this.selectedIndex].value!=''){location=this.options[this.selectedIndex].value;}>"
     for i=1 to totalpage
     response.write"<option value='" & LinkFile & "&page=" & i & "'"
     if i=gopage then response.write"selected"
     response.write">"&i&"</option>"
     next
     response.write"</select>"
     response.write" 頁(yè)<Br><Br>"

else

if blockPage = 1 Then
   Response.Write "<span disabled>【←前10頁(yè)</span>&nbsp;"
Else
   Response.Write("<span disabled>【</span><a href=" & LinkFile & "?page="&blockPage-10&">←前10頁(yè)</a>&nbsp;")
End If
    i=1
    Do Until i > 10 or blockPage > n
     If blockPage=int(gopage) Then
   Response.Write("<font color=#FF0000>[<b>"&blockPage&"</b>]</font>")
Else
   Response.Write(" <a href=" & LinkFile & "?page="&blockPage&">["&blockPage&"]</a> ")
     End If
     blockPage=blockPage+1
     i = i + 1
     Loop
if blockPage > totalpage Then
   Response.Write "&nbsp;<span disabled>后10頁(yè)→】"
Else
   Response.Write("&nbsp;<a href=" & LinkFile & "?page="&blockPage&">后10頁(yè)→</a><span disabled>】")
End If
response.write" 直接到第 "
response.write"<select onchange=if(this.options[this.selectedIndex].value!=''){location=this.options[this.selectedIndex].value;}>"
     for i=1 to totalpage
     response.write"<option value='" & LinkFile & "?page=" & i & "'"
     if i=gopage then response.write"selected"
     response.write">"&i&"</option>"
     next
     response.write"</select>"
     response.write" 頁(yè)<Br><Br>"

End If

Startinfo=((gopage-1)*msg_per_page)+1
Endinfo=gopage*msg_per_page
if Endinfo>totalrec then Endinfo=totalrec
   Response.Write("&nbsp;&nbsp;共 "&totalrec&" 條信息 當前顯示第 "&Startinfo&" - "&Endinfo&" 條 每頁(yè) "&msg_per_page&" 條信息 共 "&n&" 頁(yè)")
end if
End Function

'分頁(yè)2
Function listPages2(LinkFile)
    if not (rs.eof and rs.bof) then
gopage=currentpage
totalpage=n
blockPage=Int((gopage-1)/10)*10+1

If LCase(Request.ServerVariables("HTTPS")) = "off" Then
     strTemp = "http://"
     Else
     strTemp = "https://"
     End If
     strTemp = strTemp & CheckStr(Request.ServerVariables("SERVER_NAME"))
     If Request.ServerVariables("SERVER_PORT") <> 80 Then strTemp = strTemp & ":" & CheckStr(Request.ServerVariables("SERVER_PORT"))
     strTemp = strTemp & CheckStr(Request.ServerVariables("URL"))
     lenstrTemp=len(strTemp)+1
if instr(left(linkfile,lenstrTemp),"?")>0 then

if blockPage = 1 Then
   Response.Write "<span disabled>前10頁(yè)</span>&nbsp;"
Else
   Response.Write("<a href=" & LinkFile & "&page="&blockPage-10&">前10頁(yè)</a>&nbsp;")
End If
    i=1
    Do Until i > 10 or blockPage > n
     If blockPage=int(gopage) Then
   Response.Write("<font color=#FF0000><b>"&blockPage&"</b></font>")
Else
   Response.Write(" <a href=" & LinkFile & "&page="&blockPage&">"&blockPage&"</a> ")
     End If
     blockPage=blockPage+1
     i = i + 1
     Loop
if blockPage > totalpage Then
   Response.Write "&nbsp;<span disabled>后10頁(yè)"
Else
   Response.Write("&nbsp;<a href=" & LinkFile & "&page="&blockPage&">后10頁(yè)</a><span disabled>")
End If
response.write" 直接到第 "
response.write"<select onchange=if(this.options[this.selectedIndex].value!=''){location=this.options[this.selectedIndex].value;}>"
     for i=1 to totalpage
     response.write"<option value='" & LinkFile & "&page=" & i & "'"
     if i=gopage then response.write"selected"
     response.write">"&i&"</option>"
     next
     response.write"</select>"
     response.write" 頁(yè)<Br><Br>"

else

if blockPage = 1 Then
   Response.Write "<span disabled>【←前10頁(yè)</span>&nbsp;"
Else
   Response.Write("<span disabled>【</span><a href=" & LinkFile & "?page="&blockPage-10&">←前10頁(yè)</a>&nbsp;")
End If
    i=1
    Do Until i > 10 or blockPage > n
     If blockPage=int(gopage) Then
   Response.Write("<font color=#FF0000>[<b>"&blockPage&"</b>]</font>")
Else
   Response.Write(" <a href=" & LinkFile & "?page="&blockPage&">["&blockPage&"]</a> ")
     End If
     blockPage=blockPage+1
     i = i + 1
     Loop
if blockPage > totalpage Then
   Response.Write "&nbsp;<span disabled>后10頁(yè)→】"
Else
   Response.Write("&nbsp;<a href=" & LinkFile & "?page="&blockPage&">后10頁(yè)→</a><span disabled>】")
End If
response.write" 直接到第 "
response.write"<select onchange=if(this.options[this.selectedIndex].value!=''){location=this.options[this.selectedIndex].value;}>"
     for i=1 to totalpage
     response.write"<option value='" & LinkFile & "?page=" & i & "'"
     if i=gopage then response.write"selected"
     response.write">"&i&"</option>"
     next
     response.write"</select>"
     response.write" 頁(yè)<Br><Br>"

End If

Startinfo=((gopage-1)*msg_per_page)+1
Endinfo=gopage*msg_per_page
if Endinfo>totalrec then Endinfo=totalrec
   Response.Write("&nbsp;&nbsp;共 "&totalrec&" 條信息 當前顯示第 "&Startinfo&" - "&Endinfo&" 條 每頁(yè) "&msg_per_page&" 條信息 共 "&n&" 頁(yè)")
end if
End Function

'判斷文件類(lèi)型是否合格
Function CheckFileExt(FileExt)
Dim ForumUpload,i
ForumUpload="gif,jpg,bmp,jpeg,png"
ForumUpload=Split(ForumUpload,",")
CheckFileExt=False
For i=0 to UBound(ForumUpload)
   If LCase(FileExt)=Lcase(Trim(ForumUpload(i))) Then
    CheckFileExt=True
    Exit Function
   End If
Next
End Function
'格式后綴
Function FixName(UpFileExt)
If IsEmpty(UpFileExt) Then Exit Function
FixName = Lcase(UpFileExt)
FixName = Replace(FixName,Chr(0),"")
FixName = Replace(FixName,".","")
FixName = Replace(FixName,"asp","")
FixName = Replace(FixName,"asa","")
FixName = Replace(FixName,"aspx","")
FixName = Replace(FixName,"cer","")
FixName = Replace(FixName,"cdx","")
FixName = Replace(FixName,"htr","")
End Function
'文件Content-Type判斷
Function CheckFileType(FileType)
CheckFileType = False
If Left(Cstr(Lcase(Trim(FileType))),6)="image/" Then CheckFileType = True
End Function
%>

 

相關(guān)閱讀
CSS光標屬性一覽表
青島聯(lián)合假日旅行社
旅行社線(xiàn)路主題默認模板4
七個(gè)受用一生的心理寓言
旅行社網(wǎng)站模板11
asp許愿墻程序終于設計得差不多了,現在開(kāi)放
深山旅行社網(wǎng)站管理系統 v1.8
asp之自動(dòng)閉合HTML標簽函數
共有0條關(guān)于《ASP過(guò)濾SQL中的非法字符并格式化相關(guān)的html代碼》的評論
發(fā)表評論
正在加載評論......
返回頂部發(fā)表評論
呢 稱(chēng):
表 情:
內 容:
評論內容:不能超過(guò) 1000 字,需審核,請自覺(jué)遵守互聯(lián)網(wǎng)相關(guān)政策法規。
驗證碼: 驗證碼 
網(wǎng)友評論聲明,請自覺(jué)遵守互聯(lián)網(wǎng)相關(guān)政策法規。

您發(fā)布的評論即表示同意遵守以下條款:
一、不得利用本站危害國家安全、泄露國家秘密,不得侵犯國家、社會(huì )、集體和公民的合法權益;
二、不得發(fā)布國家法律、法規明令禁止的內容;互相尊重,對自己在本站的言論和行為負責;
三、本站對您所發(fā)布內容擁有處置權。

更多信息>>欄目類(lèi)別選擇
百度小程序開(kāi)發(fā)
微信小程序開(kāi)發(fā)
微信公眾號開(kāi)發(fā)
uni-app
asp函數庫
ASP
DIV+CSS
HTML
python
更多>>同類(lèi)信息
ASP中Utf-8與Gb2312編碼轉換亂碼問(wèn)題的解決方法頁(yè)面編碼聲明
asp顯示隨機密碼
通過(guò)阿里云服務(wù)接口獲得ip地址詳細信息
iis點(diǎn)開(kāi)后任務(wù)欄上有顯示,但是窗口看不到的解決辦法
RSA加密解密插件
微軟Encoder加密解密函數
更多>>最新添加文章
dw里面查找替換使用正則刪除sqlserver里面的CONSTRAINT
Android移動(dòng)端自動(dòng)化測試:使用UIAutomatorViewer與Selenium定位元素
抖音直播音掛載小雪花 懂車(chē)帝小程序
javascript獲取瀏覽器指紋可以用來(lái)做投票
火狐Mozilla Firefox出現:無(wú)法載入您的Firefox配置文件 它可能已經(jīng)丟失 或是無(wú)法訪(fǎng)問(wèn) 問(wèn)題解決集合處理辦法
在A(yíng)ndroid、iOS、Windows、MacOS中微信小程序的文件存放路徑
python通過(guò)代碼修改pip下載源讓下載庫飛起
python里面requests.post返回的res.text還有其它的嗎
更多>>隨機抽取信息
深山旅行社管理系統商業(yè)版增加線(xiàn)路日期報價(jià)功能樣式選擇(增加了3個(gè)日期報價(jià)效果)
Android移動(dòng)端自動(dòng)化測試:使用UIAutomatorViewer與Selenium定位元素
改進(jìn)了的,超強的title效果,看了之后,你肯定會(huì )喜歡。
深山行者個(gè)人網(wǎng)站程序V0.2 效果圖
中國大宗資產(chǎn)交易網(wǎng)
css 里面的圖片定位position高級應用
亚洲精品456在线|S级爆乳玩具酱国产VIP皮裤|欧美成人精品第一区二区三区|久久永久免费人妻精品我不卡|亚洲欧洲日产无码
<button id="nc8ni"><xmp id="nc8ni"><button id="nc8ni"></button><ins id="nc8ni"><button id="nc8ni"><form id="nc8ni"></form></button></ins>
<button id="nc8ni"><form id="nc8ni"></form></button>
<form id="nc8ni"><xmp id="nc8ni">
<ins id="nc8ni"><button id="nc8ni"></button></ins>
<button id="nc8ni"><xmp id="nc8ni">
<ins id="nc8ni"><form id="nc8ni"><ins id="nc8ni"></ins></form></ins>
<button id="nc8ni"><xmp id="nc8ni">
<button id="nc8ni"><xmp id="nc8ni">
<button id="nc8ni"><form id="nc8ni"><ins id="nc8ni"></ins></form></button><button id="nc8ni"><form id="nc8ni"></form></button>
<button id="nc8ni"><form id="nc8ni"><ins id="nc8ni"></ins></form></button><button id="nc8ni"><xmp id="nc8ni"><button id="nc8ni"></button><form id="nc8ni"><ins id="nc8ni"><form id="nc8ni"></form></ins></form><button id="nc8ni"><xmp id="nc8ni"><ins id="nc8ni"></ins>
<button id="nc8ni"><xmp id="nc8ni"><ins id="nc8ni"></ins><form id="nc8ni"><ins id="nc8ni"><form id="nc8ni"></form></ins></form>
<ins id="nc8ni"><form id="nc8ni"></form></ins>
<button id="nc8ni"><form id="nc8ni"><ins id="nc8ni"></ins></form></button>
<button id="nc8ni"></button>
<button id="nc8ni"></button>