安全性好,适用于制作论坛和进行资源下载的个人和大型网站使用!

源代码在线查看: function.asp

软件大小: 3205 K
上传用户: ashdfg
关键词: 安全性 大型 论坛
下载地址: 免注册下载 普通下载 VIP

相关代码

								function htmlencode(reString)
				dim Str
				str=reString
				str=replace(str, "&", "&")
				str=replace(str, ">", ">")
				str=replace(str, "				htmlencode=Str
				end function
				
				function leftshow(str,strlen)
					if str="" then
						leftshow=""
						exit function
					end if
					dim l,t,c, i
					str=replace(replace(replace(replace(str," "," "),""",chr(34)),">",">"),"<","					l=len(str)
					t=0
					for i=1 to l
						c=Abs(Asc(Mid(str,i,1)))
						if c>255 then
							t=t+2
						else
							t=t+1
						end if
						if t>=strlen then
							leftshow=left(str,i) & "…"
							exit for
						else
							leftshow=str
						end if
					next
					leftshow=replace(replace(replace(replace(leftshow," "," "),chr(34),"""),">",">"),"				end function
				
				function ltime(ttime,ttype)
				select case ttype
				case 1 ltime=""&year(ttime)&"年"&month(ttime)&"月"&day(ttime)&"日"
				case 2 ltime=""&year(ttime)&"/"&month(ttime)&"/"&day(ttime)&""
				case 3 ltime=""&year(ttime)&"."&month(ttime)&"."&day(ttime)&""
				case 4 ltime=""&year(ttime)&"-"&month(ttime)&"-"&day(ttime)&""
				case else ltime=""&year(ttime)&"/"&month(ttime)&"/"&day(ttime)&""
				end select
				end function
				
				Function restr(Str)
					if isnull(str) or str="" then
						exit function
					else
						restr=replace(str,"'","")
					end if
				End Function
				
				function checknum(str)
					if isnull(str) or str=""  then
						exit function
					else
						if not isnumeric(str) then
							response.write"非法操作导致程序中止!"
							response.end
						else
							checknum=int(str)
						end if
					end if
				end function
				
				function sart(str)
				sart=str
				sart=replace(sart,chr(13)&chr(10),"")
				sart=replace(sart,chr(9),chr(32)&chr(32)&chr(32)&chr(32)&chr(32)&chr(32)&chr(32)&chr(32))
				sart=replace(sart,chr(32)&chr(32)," ")
				sart=replace(sart,chr(32)," ")
				end function
				
				function checkstr(str)
					if isnull(str) or str=""  then
						exit function
					else
						checkstr=replace(str,"'","''")
					end if	
				end function
				
				function strLength(str)
					ON ERROR RESUME NEXT
					dim WINNT_CHINESE
					WINNT_CHINESE    = (len("花香")=2)
					if WINNT_CHINESE then
				        dim l,t,c
				        dim i
				        l=len(str)
				        t=l
				        for i=1 to l
				        	c=asc(mid(str,i,1))
				            if c				            if c>255 then
				                t=t+1
				            end if
				        next
				        strLength=t
				    else 
				        strLength=len(str)
				    end if
				    if err.number0 then err.clear
				end function
				
				function isInteger(para)
				       on error resume next
				       dim str
				       dim l,i
				       if isNUll(para) then 
				          isInteger=false
				          exit function
				       end if
				       str=cstr(para)
				       if trim(str)="" then
				          isInteger=false
				          exit function
				       end if
				       l=len(str)
				       for i=1 to l
				           if mid(str,i,1)>"9" or mid(str,i,1)				              isInteger=false 
				              exit function
				           end if
				       next
				       isInteger=true
				       if err.number0 then err.clear
				end function
				
				
				Function MultiPage(Numbers,Perpage,Curpage,Url_Add)
					CurPage=Int(Curpage)
					Dim URL
					URL=Request.ServerVariables("Script_Name")&Url_Add
					MultiPage=""
					Dim Page,Offset,PageI
					If Int(Numbers)>Int(PerPage) Then
						Page=10
						Offset=2
						Dim Pages,FromPage,ToPage
						If Numbers Mod Cint(Perpage)=0 Then
							Pages=Int(Numbers/Perpage)
						Else
							Pages=Int(Numbers/Perpage)+1
						End If
						FromPage=Curpage-Offset
						ToPage=Curpage+Page-Offset-1
						If Page>Pages Then
							FromPage=1
							ToPage=Pages
						Else
							If FromPage								Topage=Curpage+1-FromPage
								FromPage=1
								If (ToPage-FromPage)							ElseIF Topage>Pages Then
								FromPage =Curpage-Pages +ToPage
								ToPage=Pages
								If (ToPage-FromPage)							End If
						End If
				                MultiPage="首页 "
						If Curpage>1 Then 
				                        MultiPage=MultiPage&"上一页 "
				                Else
				                        MultiPage=MultiPage&"上一页 "
				                End If
						For PageI=FromPage TO ToPage
							If PageICurPage Then
								MultiPage=MultiPage&"["&PageI&"] "
							Else
								MultiPage=MultiPage&"["&PageI&"] "
							End If
						Next
						If Curpage				                        MultiPage=MultiPage&"下一页 "
				                Else
				                        MultiPage=MultiPage&"下一页 "
				                End If
						        MultiPage=MultiPage&"尾页"
					End If
				End Function
				%>
				
							

相关资源