2006-6-12 作者:佚名 来源:互联网 点击:1364
'----------------------------------------------------------------------
' 函数功能: 屏蔽HTML代码
' 参 数: StrInput 用户输入信息
'----------------------------------------------------------------------
function FunInput(StrInput)
if not isnull(Str) then
StrInput=RePlace(StrInput,"<","<")
StrInput=replace(StrInput,">",">")
StrinPut=replace(Strinput,chr(32)," ")
strinput=replace(strinput,chr(34),""")
strinput=replace(strinput,chr(39),"'")
strinput=replace(strinput,chr(13),"")
FunInput=strinput
end if
end function
'----------------------------------------------------------------------
' 函数功能: 防止SQL注入
' 参 数: StrValue 用户提交的数据
' BloType 数据类型
' 参 数 值: true 数值型数据
' false 字符型数据
'----------------------------------------------------------------------
function FunSQL(StrValue,BloType)
if BloType then
if Isnumeric(StrValue) then
FunSQL=clng(StrValue)
else
StrValue=0
end if
else
if not isnull(StrValue) then
StrValue=lcase(StrValue)
StrValue=Replace(StrValue,"'","''")
StrValue=replace(StrValue,"select","")
StrValue=replace(StrValue,"update","")
StrValue=replace(StrValue,"insert","")
StrValue=replace(StrValue,"delete","")
StrValue=replace(StrValue,";","")
StrValue=replace(StrValue," ","")
StrValue=replace(StrValue,chr(255),"")
StrValue=replace(StrValue,"*","")
StrValue=replace(StrValue,"%","")
end if
end if
FunSQL=StrValue
end function
'--------------------------------------------------------------------------
' 函数功能: 常用类型转换
' 参 数: _Type 数据类型
' _Value 数据
' 参 数 值: _Type 1 : 转换成数值型数据
' _Type 2 : 转换成字符型数据
' _Type 3 : 转换成布尔型数据
'--------------------------------------------------------------------------
function FunSwitch(Value_,Type_)
on error resume next
select case Type_
case 1
if isnumeric(Value_) then
if not isnull(Value_) then
FunSwitch=clng(Value_)
else
FunSwitch=0
end if
else
FunSwitch=0
end if
case 2
if not isnull(Value_) then
FunSwitch=cstr(Value_)
else
FunSwitch=""
end if
case 3
if not isnull(Value_) and isnumeric(Value_) then
FunSwitch=cbool(Value_)
else
FunSwitch=false
end if
case else
response.redirect("Error.asp?err=请指定 FunSwitch 中要转达换成的数据类型!")
end select
if err.number<>0 then
response.redirect("Error.asp?err=数据转换时产生未知错误!")
err.clear
end if
end function
''----------------------------------------------------------------------
' 函数功能: 验证是数据是否来自外部
' 参 数: 无
'----------------------------------------------------------------------
function checkfrom()
server_v1=Cstr(Request.ServerVariables("HTTP_REFERER"))
server_v2=Cstr(Request.ServerVariables("SERVER_NAME"))
if mid(server_v1,8,len(server_v2))<>server_v2 then
checkfrom=true
else
checkfrom=false
end if
end function
''----------------------------------------------------------------------
' 函数功能: JS提示框
' 参 数: StrURL : 点击确定后返回到的页面地址
' StrMSG : 对话框的提示信息
'----------------------------------------------------------------------
Function FunMsg(StrURL,StrMSG)
Response.write "<script language='javascript'>"&_
Vbcrlf&"alert("""&StrMSG&""");"&_
Vbcrlf&"window.location="""&StrURL&""";"&_
Vbcrlf&"</script>"
End Function
'--------------------------------------------------------------------------
' 函数功能: 通用分页
' 参 数: Intpagecount 总页数
' Intmypage 当前页数
' Intrecordcount 记录总数
' Intpagesize 每页显示的记录数
'--------------------------------------------------------------------------
function funpage(Intpagecount,Intmypage,Intrecordcount,Intpagesize)
'on error resume next
dim Intfor,Intlist,intlist_b
Dim query, a, x, temp
action = "http://"&Request.ServerVariables("HTTP_HOST& ... s("SCRIPT_NAME")
query = Split(Request.ServerVariables("QUERY_STRING"), "&")
For Each x In query
a = Split(x, "=")
If StrComp(a(0), "page", vbTextCompare) <> 0 Then
temp = temp & a(0) & "=" & a(1) & "&"
End If
Next
if intmypage>1 then
funpage=funpage & "<a href='"&action&"?"&temp&"page=1' title='最前页' class='no'><font face='Webdings'>9</font></a>"
funpage=funpage&"<a href='"&action&"?"&temp&"page="&Intmypage-1 & "' title='上一页' class='no'><font face='Webdings'>7</font></a>"
else
funpage=funpage &"<font face='Webdings'>9</font>"
funpage=funpage&"<font face='Webdings'>7</font>"
end if
if Intlist<>0 then
if cintmypage= Intlist then
Intlist=Intlist+5
end if
else
Intlist=Intmypage+5
end if
if intlist-9<1 then
intlist_b=1
else
intlist_b=intlist-9
end if
for Intfor=intlist_b to Intlist
if intfor<=Intpagecount then
if intfor=Intmypage then '-------使当前页文字为红色,并不可点击
funpage =funpage & strMode&" <font color='#FF0000'><b>"& Intfor & "</b></font>"
else
funpage=funpage & strMode &" <a href='"&action&"?"&temp&"page=" & Intfor &"' class='no'>" & Intfor & "</a>"
end if
end if
strMode=" <font color='#BBBBBB'>|</font> "
next
if intmypage<intpagecount then
funpage=funpage&" <a href='"&action&"?"&temp&"page="& Intmypage+1 &"' title='后一页' class='no'><font face='Webdings'>8</font></a>"
funpage=funpage &"<a href='"&action&"?"&temp&"page="& Intpagecount & "' title='最后页' class='no'><font face='Webdings'>:</font></a>"
else
funpage=funpage&" <font face='Webdings'>8</font>"
funpage=funpage &"<font face='Webdings'>:</font></a>"
end if
funpage="<table width='100%' border='0' cellspacing='0' cellpadding='0'><tr>"&_
vbcrlf&"<td width='40%' style=font:14px> 当前第"&Intmypage&"页 "&Intpagesize&"条/页 共"&Intpagecount&"页/"&Intrecordcount&"条记录</td>"&_
vbcrlf&"<td width='60%' align='right'>"&_
vbcrlf&"<table width='360' border='0' cellspacing='0' cellpadding='0'><tr>"&_
vbcrlf&"<td align='right' style=font:14px>"&funpage&" </td>"&_
vbcrlf&"</tr></table></td></tr>"&_
vbcrlf&"</table>"
if err.number<>0 then
err.clear
response.redirect("error.asp?err=分页函数出错,请与管理员联系!|")
end if
end function
'***************************************************
'函数名:Highlight
'功能:搜索的关键词以高亮的颜色显示
'参数strText是要被高亮显示的字符串或变量所在的字串或变量
'strFind是要被高亮显示的字符串或变量,
'strBefore被高亮显示的HTML代码前缀如:<font color=red>
'strAfter被高亮显示的HTML代码的后缀:</font>
'*****************************************************
Function Highlight(strText, strFind, strBefore, strAfter)
Dim nPos
Dim nLen
Dim nLenAll
nLen = Len(strFind)
nLenAll = nLen + Len(strBefore) + Len(strAfter) + 1
Highlight = strText
If nLen > 0 And Len(Highlight) > 0 Then
nPos = InStr(1, Highlight, strFind, 1)
Do While nPos > 0
Highlight = Left(Highlight, nPos - 1) & _
strBefore & Mid(Highlight, nPos, nLen) & strAfter & _
Mid(Highlight, nPos + nLen)
nPos = InStr(nPos + nLenAll, Highlight, strFind, 1)
Loop
End If
End Function
' 函数功能: 屏蔽HTML代码
' 参 数: StrInput 用户输入信息
'----------------------------------------------------------------------
function FunInput(StrInput)
if not isnull(Str) then
StrInput=RePlace(StrInput,"<","<")
StrInput=replace(StrInput,">",">")
StrinPut=replace(Strinput,chr(32)," ")
strinput=replace(strinput,chr(34),""")
strinput=replace(strinput,chr(39),"'")
strinput=replace(strinput,chr(13),"")
FunInput=strinput
end if
end function
'----------------------------------------------------------------------
' 函数功能: 防止SQL注入
' 参 数: StrValue 用户提交的数据
' BloType 数据类型
' 参 数 值: true 数值型数据
' false 字符型数据
'----------------------------------------------------------------------
function FunSQL(StrValue,BloType)
if BloType then
if Isnumeric(StrValue) then
FunSQL=clng(StrValue)
else
StrValue=0
end if
else
if not isnull(StrValue) then
StrValue=lcase(StrValue)
StrValue=Replace(StrValue,"'","''")
StrValue=replace(StrValue,"select","")
StrValue=replace(StrValue,"update","")
StrValue=replace(StrValue,"insert","")
StrValue=replace(StrValue,"delete","")
StrValue=replace(StrValue,";","")
StrValue=replace(StrValue," ","")
StrValue=replace(StrValue,chr(255),"")
StrValue=replace(StrValue,"*","")
StrValue=replace(StrValue,"%","")
end if
end if
FunSQL=StrValue
end function
'--------------------------------------------------------------------------
' 函数功能: 常用类型转换
' 参 数: _Type 数据类型
' _Value 数据
' 参 数 值: _Type 1 : 转换成数值型数据
' _Type 2 : 转换成字符型数据
' _Type 3 : 转换成布尔型数据
'--------------------------------------------------------------------------
function FunSwitch(Value_,Type_)
on error resume next
select case Type_
case 1
if isnumeric(Value_) then
if not isnull(Value_) then
FunSwitch=clng(Value_)
else
FunSwitch=0
end if
else
FunSwitch=0
end if
case 2
if not isnull(Value_) then
FunSwitch=cstr(Value_)
else
FunSwitch=""
end if
case 3
if not isnull(Value_) and isnumeric(Value_) then
FunSwitch=cbool(Value_)
else
FunSwitch=false
end if
case else
response.redirect("Error.asp?err=请指定 FunSwitch 中要转达换成的数据类型!")
end select
if err.number<>0 then
response.redirect("Error.asp?err=数据转换时产生未知错误!")
err.clear
end if
end function
''----------------------------------------------------------------------
' 函数功能: 验证是数据是否来自外部
' 参 数: 无
'----------------------------------------------------------------------
function checkfrom()
server_v1=Cstr(Request.ServerVariables("HTTP_REFERER"))
server_v2=Cstr(Request.ServerVariables("SERVER_NAME"))
if mid(server_v1,8,len(server_v2))<>server_v2 then
checkfrom=true
else
checkfrom=false
end if
end function
''----------------------------------------------------------------------
' 函数功能: JS提示框
' 参 数: StrURL : 点击确定后返回到的页面地址
' StrMSG : 对话框的提示信息
'----------------------------------------------------------------------
Function FunMsg(StrURL,StrMSG)
Response.write "<script language='javascript'>"&_
Vbcrlf&"alert("""&StrMSG&""");"&_
Vbcrlf&"window.location="""&StrURL&""";"&_
Vbcrlf&"</script>"
End Function
'--------------------------------------------------------------------------
' 函数功能: 通用分页
' 参 数: Intpagecount 总页数
' Intmypage 当前页数
' Intrecordcount 记录总数
' Intpagesize 每页显示的记录数
'--------------------------------------------------------------------------
function funpage(Intpagecount,Intmypage,Intrecordcount,Intpagesize)
'on error resume next
dim Intfor,Intlist,intlist_b
Dim query, a, x, temp
action = "http://"&Request.ServerVariables("HTTP_HOST& ... s("SCRIPT_NAME")
query = Split(Request.ServerVariables("QUERY_STRING"), "&")
For Each x In query
a = Split(x, "=")
If StrComp(a(0), "page", vbTextCompare) <> 0 Then
temp = temp & a(0) & "=" & a(1) & "&"
End If
Next
if intmypage>1 then
funpage=funpage & "<a href='"&action&"?"&temp&"page=1' title='最前页' class='no'><font face='Webdings'>9</font></a>"
funpage=funpage&"<a href='"&action&"?"&temp&"page="&Intmypage-1 & "' title='上一页' class='no'><font face='Webdings'>7</font></a>"
else
funpage=funpage &"<font face='Webdings'>9</font>"
funpage=funpage&"<font face='Webdings'>7</font>"
end if
if Intlist<>0 then
if cintmypage= Intlist then
Intlist=Intlist+5
end if
else
Intlist=Intmypage+5
end if
if intlist-9<1 then
intlist_b=1
else
intlist_b=intlist-9
end if
for Intfor=intlist_b to Intlist
if intfor<=Intpagecount then
if intfor=Intmypage then '-------使当前页文字为红色,并不可点击
funpage =funpage & strMode&" <font color='#FF0000'><b>"& Intfor & "</b></font>"
else
funpage=funpage & strMode &" <a href='"&action&"?"&temp&"page=" & Intfor &"' class='no'>" & Intfor & "</a>"
end if
end if
strMode=" <font color='#BBBBBB'>|</font> "
next
if intmypage<intpagecount then
funpage=funpage&" <a href='"&action&"?"&temp&"page="& Intmypage+1 &"' title='后一页' class='no'><font face='Webdings'>8</font></a>"
funpage=funpage &"<a href='"&action&"?"&temp&"page="& Intpagecount & "' title='最后页' class='no'><font face='Webdings'>:</font></a>"
else
funpage=funpage&" <font face='Webdings'>8</font>"
funpage=funpage &"<font face='Webdings'>:</font></a>"
end if
funpage="<table width='100%' border='0' cellspacing='0' cellpadding='0'><tr>"&_
vbcrlf&"<td width='40%' style=font:14px> 当前第"&Intmypage&"页 "&Intpagesize&"条/页 共"&Intpagecount&"页/"&Intrecordcount&"条记录</td>"&_
vbcrlf&"<td width='60%' align='right'>"&_
vbcrlf&"<table width='360' border='0' cellspacing='0' cellpadding='0'><tr>"&_
vbcrlf&"<td align='right' style=font:14px>"&funpage&" </td>"&_
vbcrlf&"</tr></table></td></tr>"&_
vbcrlf&"</table>"
if err.number<>0 then
err.clear
response.redirect("error.asp?err=分页函数出错,请与管理员联系!|")
end if
end function
'***************************************************
'函数名:Highlight
'功能:搜索的关键词以高亮的颜色显示
'参数strText是要被高亮显示的字符串或变量所在的字串或变量
'strFind是要被高亮显示的字符串或变量,
'strBefore被高亮显示的HTML代码前缀如:<font color=red>
'strAfter被高亮显示的HTML代码的后缀:</font>
'*****************************************************
Function Highlight(strText, strFind, strBefore, strAfter)
Dim nPos
Dim nLen
Dim nLenAll
nLen = Len(strFind)
nLenAll = nLen + Len(strBefore) + Len(strAfter) + 1
Highlight = strText
If nLen > 0 And Len(Highlight) > 0 Then
nPos = InStr(1, Highlight, strFind, 1)
Do While nPos > 0
Highlight = Left(Highlight, nPos - 1) & _
strBefore & Mid(Highlight, nPos, nLen) & strAfter & _
Mid(Highlight, nPos + nLen)
nPos = InStr(nPos + nLenAll, Highlight, strFind, 1)
Loop
End If
End Function
声明:本站刊载此文不代表同意其说法或描述,仅为提供更多信息,也不构成任何建议。如有疑问请与站长联系。
相关链接更多...
- php图片防盗链功能2006-6-12
- 用ASP实现长文章用分页符来分页显示2006-6-12
- 常用的ASP函数与大家分享2006-6-12
- ASP小偷(远程数据获取)程序入门教程2006-6-12
- asp批量抓取某个列表页2006-6-12
- 本站javascript 仿flash新闻图片切换效果-推荐2006-6-12
- js实现屏蔽右键菜单,防选择,防拷贝,防粘贴2006-6-12
网友评论
目前没有评论!
全站精华
图文精彩
![韩国知名三维制作者李素雅cg作品欣赏[图]--CG插画](http://www.fansart.com/uploadfile/20066967597489.gif)
【2006-6-9 18:40:03】
韩国知名三维制作者李素雅cg作品欣赏
韩国知名三维制作者李素雅cg作品欣赏
![王开立的象素画-"华容点翠"系列1[图]--CG插画](http://www.fansart.com/uploadfile/20066967740609.gif)
【2006-6-8 17:40:50】
王开立的象素画-"华容点翠"系列1
王开立的象素画-"华容点翠"系列1

【2006-5-10 18:31:05】
风景摄影欣赏molnies 1
风景摄影欣赏molnies 1
![人像摄影:《炫影》(1)[图]--摄影艺术](http://www.fansart.com/uploadfile/20065966294533.gif)
【2006-5-9 18:18:49】
人像摄影:《炫影》(1)
人像摄影:《炫影》(1)

【2006-5-8 11:37:48】
韩国品牌YSB夏装 冷艳美人异国风情(3)
韩国品牌YSB夏装 冷艳美人异国风情(3)

【2006-5-8 9:52:42】
MIKE H的CG插画作品欣赏(1)
MIKE H的CG插画作品欣赏(1)
![经典样本设计欣赏(国人作品)1[图]--平面广告](http://www.fansart.com/uploadfile/200642664631465.jpg)
【2006-4-26 17:57:18】
经典样本设计欣赏(国人作品)1
经典样本设计欣赏(国人作品)1

【2006-4-26 14:27:13】
新锐CG插画 Monday to Friday
新锐CG插画 Monday to Friday

【2006-4-26 13:34:46】
Natascha Roeoesli的人物CG插画作品欣赏(1)
Natascha Roeoesli的人物CG插画作品欣赏(1)
![水木清华地产广告欣赏[图]--平面广告](http://www.fansart.com/uploadfile/200642634295921.jpg)
【2006-4-26 9:31:54】
水木清华地产广告欣赏
水木清华地产广告欣赏
![2006夏日流行时尚,创意无限街头华丽[图]--时装魅影](http://www.fansart.com/uploadfile/200642261089093.jpg)
【2006-4-22 16:46:51】
2006夏日流行时尚,创意无限街头华丽
2006夏日流行时尚,创意无限街头华丽
![万科西山庭院.格.沉.尊[图]--平面广告](http://www.fansart.com/uploadfile/200642133015939.jpg)
【2006-4-21 9:08:35】
万科西山庭院.格.沉.尊
万科西山庭院.格.沉.尊
![泊林花园推广故事绘本(2)[图]--CG插画](http://www.fansart.com/uploadfile/200642042197577.jpg)
【2006-4-20 11:43:23】
泊林花园推广故事绘本(2)
泊林花园推广故事绘本(2)
![泊林花园推广故事绘本(1)[图]--CG插画](http://www.fansart.com/uploadfile/200642041664949.jpg)
【2006-4-20 11:34:33】
泊林花园推广故事绘本(1)
泊林花园推广故事绘本(1)
![房地产广告设计-之水墨风格1[图]--平面广告](http://www.fansart.com/uploadfile/200641457308753.jpg)
【2006-4-14 15:56:06】
房地产广告设计-之水墨风格1
房地产广告设计-之水墨风格1
![溯源居广告欣赏--小红人[图]--平面广告](http://www.fansart.com/uploadfile/200641453136345.jpg)
【2006-4-14 14:45:57】
溯源居广告欣赏--小红人
溯源居广告欣赏--小红人
![cg插画欣赏[图]--CG插画](http://www.fansart.com/uploadfile/200641433658593.jpg)
【2006-4-14 9:21:18】
cg插画欣赏
cg插画欣赏
![yashasi插画作品欣赏[图]--CG插画](http://www.fansart.com/uploadfile/200641366906025.jpg)
【2006-4-13 18:32:29】
yashasi插画作品欣赏
yashasi插画作品欣赏
![北邦插画欣赏(1)[图]--CG插画](http://www.fansart.com/uploadfile/200641335800545.jpg)
【2006-4-13 9:49:02】
北邦插画欣赏(1)
北邦插画欣赏(1)
![高傲的玫瑰-温碧霞[图]--摄影艺术](http://www.fansart.com/uploadfile/200641232299455.jpg)
【2006-4-12 8:58:34】
高傲的玫瑰-温碧霞
高傲的玫瑰-温碧霞