asp常用函数'-------------------------------------
asp常用函数

asp常用函数
asp常用函数
'所有功能函数名如下:
asp常用函数'
 StrLength(str) 取得字符串长度
asp常用函数'
 CutStr(str,strlen) 字符串长度切割
asp常用函数'
 CheckIsEmpty(tstr) 检测是否为空
asp常用函数'
 isInteger(para) 整数检验
asp常用函数'
 CheckName(str) 名字字符校验
asp常用函数'
 CheckPassword(str) 密码检验
asp常用函数'
 CheckEmail(email) 邮箱格式检验
asp常用函数'
 Alert(msg,goUrl) 弹出对话框提示
asp常用函数'
 GoBack(Str1,Str2,isback) 出错信息提示
asp常用函数'
 Suc(str1,str2,url) 操作成功信息提示
asp常用函数'
 ChkPost() 检测是否站外提交表单
asp常用函数'
 PSql() 防止sql注入
asp常用函数'
 FiltrateHtmlCode(Str) 防止生成HTML
asp常用函数'
 HtmlCode(str) 过滤HTML
asp常用函数'
 Replacehtml(tstr) 清滤HTML
asp常用函数'
 GetIP() 获取客户端IP
asp常用函数'
 GetBrowser 获取客户端浏览器信
asp常用函数'
 GetSystem 获取客户端操作系统
asp常用函数'
 GetUrl() 获取当前页面URL包含参数
asp常用函数'
 CUrl()   获取当前页面URL
asp常用函数'
 GetExtend 取得文件扩展名
asp常用函数'
 CheckExist(table,fieldname,fieldcontent,isblur) 检测某个表中某个字段的内容是否存在
asp常用函数'
 GetNum(table,fieldname,resulttype,args) 检测某个表某个字段有多少条,最大值 ,最小值等
asp常用函数'
 GetFolderSize(Folderpath) 计算某个文件夹的大小
asp常用函数'
 GetFileSize(Filename) 计算某个文件的大小
asp常用函数'
 IsObjInstalled(strClassString) 检测组件是否安装
asp常用函数'
 SendMail JMAIL发送邮件
asp常用函数'
 ResponseCookies 写入cookies
asp常用函数'
 CleanCookies 清除cookies
asp常用函数'
 GetTimeover 取得程序页面执行时间
asp常用函数'
 FormatSize 大小格式化
asp常用函数'
 FormatTime 时间格式化
asp常用函数'
 Zodiac 取得生肖
asp常用函数'
 Constellation   取得星座
asp常用函数'
-------------------------------------
asp常用函数

asp常用函数Class Cls_fun
asp常用函数
asp常用函数
'--------字符处理--------------------------
asp常用函数
    
asp常用函数
'****************************************************
asp常用函数'
函数名:StrLength
asp常用函数'
作  用:取得字符串长度(汉字为2)
asp常用函数'
参  数:str ----字符串内容
asp常用函数'
返回值:字符串长度
asp常用函数'
****************************************************
asp常用函数
Public function StrLength(str)
asp常用函数   
Dim Rep,lens,i
asp常用函数   
Set rep=new regexp
asp常用函数   rep.Global
=true
asp常用函数   rep.IgnoreCase
=true
asp常用函数   rep.Pattern
="[\u4E00-\u9FA5\uF900-\uFA2D]"
asp常用函数   
For each i in rep.Execute(str)
asp常用函数    lens
=lens+1
asp常用函数   
Next
asp常用函数   
Set Rep=Nothing
asp常用函数   lens
=lens + len(str)
asp常用函数   strLength
=lens
asp常用函数  
End Function
asp常用函数  
asp常用函数
'****************************************************
asp常用函数'
函数名:CutStr
asp常用函数'
作  用:字符串长度切割,超过显示省略号
asp常用函数'
参  数:str    ----字符串内容
asp常用函数'
       strlen ------要显示的长度
asp常用函数'
返回值:切割后字符串内容
asp常用函数'
****************************************************
asp常用函数
Public Function CutStr(str,strlen)
asp常用函数     
Dim l,t,i,c
asp常用函数     
If str="" Then
asp常用函数     cutstr
=""
asp常用函数     
Exit Function
asp常用函数     
End If
asp常用函数     str
=Replace(Replace(Replace(Replace(Replace(str,"&nbsp;"," "),"&quot;",Chr(34)),"&gt;",">"),"&lt;","<"),"|","|")
asp常用函数     l
=Len(str)
asp常用函数     t
=0
asp常用函数     
For i=1 To l
asp常用函数     c
=Abs(Asc(Mid(str,i,1)))
asp常用函数     
If c>255 Then
asp常用函数    t
=t+2
asp常用函数     
Else
asp常用函数    t
=t+1
asp常用函数     
End If
asp常用函数     
If t>=strlen Then
asp常用函数    cutstr
=Left(str,i) & "asp常用函数"
asp常用函数    
Exit For
asp常用函数     
Else
asp常用函数    cutstr
=str
asp常用函数     
End If
asp常用函数     
Next
asp常用函数     cutstr
=Replace(Replace(Replace(Replace(replace(cutstr," ","&nbsp;"),Chr(34),"&quot;"),">","&gt;"),"<","&lt;"),"|","|")
asp常用函数  
End Function
asp常用函数
asp常用函数
'--------------系列验证----------------------------
asp常用函数

asp常用函数    
'****************************************************
asp常用函数'
函数名:CheckIsEmpty
asp常用函数'
作  用:检查是否为空
asp常用函数'
参  数:tstr ----字符串
asp常用函数'
返回值:true不为空,false为空
asp常用函数'
****************************************************
asp常用函数
Public Function CheckIsEmpty(tstr)
asp常用函数  CheckIsEmpty
=false
asp常用函数  
If IsNull(tstr) or Tstr="" Then Exit Function 
asp常用函数  
Dim Str,re
asp常用函数  Str
=Tstr
asp常用函数  
Set re=new RegExp
asp常用函数  re.IgnoreCase 
=True
asp常用函数  re.Global
=True
asp常用函数  str
= Replace(str, vbNewLine, "")
asp常用函数  str 
= Replace(str, Chr(9), "")
asp常用函数  str 
= Replace(str, " """)
asp常用函数  str 
= Replace(str, "&nbsp;""")
asp常用函数  re.Pattern
="<img(.[^>]*)>"
asp常用函数  str 
=re.Replace(Str,"94kk")
asp常用函数  re.Pattern
="<(.[^>]*)>"
asp常用函数  Str
=re.Replace(Str,"")
asp常用函数  
Set Re=Nothing
asp常用函数  
If Str<>"" Then CheckIsEmpty=true
asp常用函数
End Function
asp常用函数
asp常用函数    
'****************************************************
asp常用函数'
函数名:isInteger
asp常用函数'
作  用:整数检验
asp常用函数'
参  数:tstr ----字符
asp常用函数'
返回值:true是整数,false不是整数
asp常用函数'
****************************************************
asp常用函数
Public function isInteger(para)
asp常用函数     
on error resume Next
asp常用函数     
Dim str
asp常用函数     
Dim l,i
asp常用函数     
If isNUll(para) then 
asp常用函数     isInteger
=false
asp常用函数     
exit function
asp常用函数     
End if
asp常用函数     str
=cstr(para)
asp常用函数     
If trim(str)="" then
asp常用函数     isInteger
=false
asp常用函数     
exit function
asp常用函数     
End if
asp常用函数     l
=len(str)
asp常用函数     
For i=1 to l
asp常用函数      
If mid(str,i,1)>"9" or mid(str,i,1)<"0" then
asp常用函数      isInteger
=false 
asp常用函数      
exit function
asp常用函数      
End if
asp常用函数     
Next
asp常用函数     isInteger
=true
asp常用函数     
If err.number<>0 then err.clear
asp常用函数
End Function
asp常用函数
asp常用函数    
'****************************************************
asp常用函数'
函数名:CheckName
asp常用函数'
作  用:名字字符检验 
asp常用函数'
参  数:str ----字符串
asp常用函数'
返回值:true无误,false有误
asp常用函数'
****************************************************
asp常用函数
Public Function CheckName(Str)
asp常用函数  Checkname
=true
asp常用函数  
Dim Rep,pass
asp常用函数  
Set Rep=New RegExp
asp常用函数  Rep.Global
=True
asp常用函数  Rep.IgnoreCase
=True
asp常用函数  
'匹配字母、数字、下划线、汉字且必须以字母或下划线或汉字开始
asp常用函数
  Rep.Pattern="^[a-zA-Z_u4e00-\u9fa5][\w\u4e00-\u9fa5]+$"
asp常用函数  
Set pass=Rep.Execute(Str)
asp常用函数  
If pass.count=0 Then CheckName=false
asp常用函数  
Set Rep=Nothing
asp常用函数
End Function
asp常用函数
asp常用函数
'****************************************************
asp常用函数'
函数名:CheckPassword
asp常用函数'
作  用:密码检验
asp常用函数'
参  数:str ----字符串
asp常用函数'
返回值:true无误,false有误
asp常用函数'
****************************************************
asp常用函数
Public Function CheckPassword(Str)
asp常用函数  
Dim pass
asp常用函数  CheckPassword
=true
asp常用函数  
If Str <> "" Then
asp常用函数   
Dim Rep
asp常用函数   
Set Rep = New RegExp
asp常用函数   Rep.Global 
= True
asp常用函数   Rep.IgnoreCase 
= True
asp常用函数   
'匹配字母、数字、下划线、点号
asp常用函数
   Rep.Pattern="[a-zA-Z0-9_\.]+$"
asp常用函数   Pass
=rep.Test(Str)
asp常用函数   
Set Rep=nothing
asp常用函数   
If not Pass Then CheckPassword=false
asp常用函数   
End If
asp常用函数
End Function 
asp常用函数
asp常用函数
'****************************************************
asp常用函数'
函数名:CheckEmail
asp常用函数'
作  用:邮箱格式检测
asp常用函数'
参  数:str ----Email地址
asp常用函数'
返回值:true无误,false有误
asp常用函数'
****************************************************
asp常用函数
Public function CheckEmail(email)
asp常用函数     CheckEmail
=true
asp常用函数  
Dim Rep
asp常用函数  
Set Rep = new RegExp
asp常用函数  rep.pattern
="([\.a-zA-Z0-9_-]){2,10}@([a-zA-Z0-9_-]){2,10}(\.([a-zA-Z0-9]){2,}){1,4}$"
asp常用函数  pass
=rep.Test(email)
asp常用函数  
Set Rep=Nothing
asp常用函数  
If not pass Then CheckEmail=false
asp常用函数
End function
asp常用函数
asp常用函数
'--------------信息提示----------------------------  
asp常用函数'
****************************************************
asp常用函数'
函数名:Alert
asp常用函数'
作  用:弹出对话框提示
asp常用函数'
参  数:msg   ----对话框信息
asp常用函数'
       gourl ----提示后转向哪里
asp常用函数'
返回值:无
asp常用函数'
****************************************************
asp常用函数
    Public Function Alert(msg,goUrl)
asp常用函数  msg 
= replace(msg,"'","\'")
asp常用函数    
If goUrl="" Then
asp常用函数     goUrl
="history.go(-1);"
asp常用函数  
Else
asp常用函数   goUrl
="window.location.href='"&goUrl&"'"
asp常用函数  
End IF
asp常用函数  Response.Write (
"<script language=""JavaScript"" type=""text/javascript"">"&vbNewLine&"alert('" & msg & "');"&goUrl&vbNewLine&"</script>")
asp常用函数  Response.End
asp常用函数
End Function
asp常用函数
asp常用函数    
'****************************************************
asp常用函数'
函数名:GoBack
asp常用函数'
作  用:错误信息提示
asp常用函数'
参  数:str1   ----信息提示标题
asp常用函数'
       str2   ----信息提示内容
asp常用函数'
       isback ----是否显示返回
asp常用函数'
返回值:无
asp常用函数'
****************************************************
asp常用函数
Public Function GoBack(Str1,Str2,isback)
asp常用函数  
If Str1="" Then Str1="错误信息"
asp常用函数  
If Str2="" Then Str2="请填写完整必填项目"
asp常用函数  
If isback="" Then 
asp常用函数   Str2
=Str2&" <a href=""javascript:history.go(-1)"">返回重填</a></li>"
asp常用函数  
else
asp常用函数   Str2
=Str2
asp常用函数  
end if
asp常用函数  Response.Write
"<div style=""margin-left:5px;border:1px solid #0066cc;width:98%""><div style=""height:22px;font-weight:bold;color : white;font-size:14px;background:#799AE1;background:url(images/th.gif);;text-align:left;line-height:20px;padding:3px;"">"&Str1&" </div><div style=""line-height:50px;background:#F7F7F7;vertical-align:middle;font-size:14px;width:100%""><div  style=""color:red;font:50px/50px 宋体;float:left;width:5%"">×</div><div  style=""margin-top:8px;float:right;width:90%;text-align:left;padding-left:3px;"">"&str2&"</div></div></div>"
asp常用函数  response.end
asp常用函数
End Function
asp常用函数
asp常用函数    
'****************************************************
asp常用函数'
函数名:Suc
asp常用函数'
作  用:成功提示信息
asp常用函数'
参  数:str1   ----信息提示标题
asp常用函数'
       str2   ----信息提示内容
asp常用函数'
       url    ----返回地址
asp常用函数'
返回值:无
asp常用函数'
****************************************************
asp常用函数
Public Function Suc(str1,str2,url)
asp常用函数  
If str1="" Then Str1="操作成功"
asp常用函数  
If str2="" Then Str2="成功的完成这次操作!"
asp常用函数  
If url="" Then url="javascript:history.go(-1)"
asp常用函数  str2
=str2&"&nbsp;&nbsp;<a href="""&url&""" >返回继续管理</a>"
asp常用函数  Response.Write
"<div style=""margin-left:5px;border:1px solid #0066cc;width:98%""><div style=""height:22px;font-weight:bold;color : white;font-size:14px;background:#799AE1;background:url(images/th.gif);;text-align:left;line-height:20px;padding:3px;"">"&Str1&" </div><div style=""line-height:50px;background:#F7F7F7;vertical-align:middle;font-size:14px;width:100%""><div  style=""color:red;font:50px/50px 宋体;float:left;width:5%"">√</div><div  style=""margin-top:8px;float:right;width:90%;text-align:left;padding-left:3px;"">"&str2&"</div></div></div>"
asp常用函数
End Function
asp常用函数
asp常用函数
'--------------安全处理---------------------------- 
asp常用函数

asp常用函数
'****************************************************
asp常用函数'
函数名:ChkPost
asp常用函数'
作  用:禁止站外提交表单
asp常用函数'
返回值:true站内提交,flase站外提交
asp常用函数'
****************************************************
asp常用函数
Public Function ChkPost()
asp常用函数  
Dim url1,url2
asp常用函数  chkpost
=true
asp常用函数  url1
=Cstr(Request.ServerVariables("HTTP_REFERER"))
asp常用函数  url2
=Cstr(Request.ServerVariables("SERVER_NAME"))
asp常用函数  
If Mid(url1,8,Len(url2))<>url2 Then
asp常用函数    chkpost
=false
asp常用函数    
exit function
asp常用函数  
End If
asp常用函数
End function
asp常用函数
asp常用函数
'****************************************************
asp常用函数'
函数名:PSql
asp常用函数'
作  用:防止SQL注入
asp常用函数'
返回值:为空则无注入,不为空则注入并返回注入的字符
asp常用函数'
****************************************************
asp常用函数
public Function PSql()
asp常用函数     Psql
=""
asp常用函数  badwords
= "'防''防;防and防exec防insert防select防update防delete防count防*防%防chr防mid防master防truncate防char防declare防|"
asp常用函数  badword
=split(badwords,"")
asp常用函数  
If Request.Form<>"" Then
asp常用函数   
For Each TF_Post In Request.Form
asp常用函数    
For i=0 To Ubound(badword)
asp常用函数     
If Instr(LCase(Request.Form(TF_Post)),badword(i))>0 Then
asp常用函数      Psql
=badword(i)
asp常用函数      
exit function
asp常用函数     
End If
asp常用函数    
Next
asp常用函数   
Next
asp常用函数  
End If
asp常用函数  
If Request.QueryString<>"" Then
asp常用函数   
For Each TF_Get In Request.QueryString
asp常用函数    
For i=0 To Ubound(badword)
asp常用函数     
If Instr(LCase(Request.QueryString(TF_Get)),badword(i))>0 Then
asp常用函数      Psql
=badword(i)
asp常用函数      
exit function
asp常用函数     
End If
asp常用函数    
Next
asp常用函数   
Next
asp常用函数  
End If
asp常用函数
End Function
asp常用函数
asp常用函数    
'****************************************************
asp常用函数'
函数名:FiltrateHtmlCode
asp常用函数'
作  用:防止生成html代码 
asp常用函数'
参  数:str ----字符串
asp常用函数'
****************************************************
asp常用函数
Public Function FiltrateHtmlCode(Str)
asp常用函数  
If Not isnull(str) And str<>"" then
asp常用函数   Str
=Replace(Str,Chr(9),"")
asp常用函数   Str
=replace(Str,"|","|")
asp常用函数   Str
=replace(Str,chr(39),"'")
asp常用函数   Str
=replace(Str,"<","&lt;")
asp常用函数   Str
=replace(Str,">","&gt;")
asp常用函数   Str 
= Replace(str, CHR(13),"")
asp常用函数   Str 
= Replace(str, CHR(10),"")
asp常用函数   FiltrateHtmlCode
=Str
asp常用函数  
End If
asp常用函数
End Function
asp常用函数
asp常用函数    
'****************************************************
asp常用函数'
函数名:HtmlCode
asp常用函数'
作  用:过滤Html标签
asp常用函数'
参  数:str ----字符串
asp常用函数'
****************************************************
asp常用函数
Public function HtmlCode(str)
asp常用函数  
If Not isnull(str) And str<>"" then
asp常用函数   str 
= replace(str, ">""&gt;")
asp常用函数   str 
= replace(str, "<""&lt;")
asp常用函数   str 
= Replace(str, CHR(32), " ")
asp常用函数   str 
= Replace(str, CHR(9), "&nbsp;")
asp常用函数   str 
= Replace(str, CHR(34), "&quot;")
asp常用函数   str 
= Replace(str, CHR(39), "'")
asp常用函数   str 
= Replace(str, CHR(13), "")
asp常用函数   str 
= Replace(str, CHR(10), "")
asp常用函数   str 
= Replace(str, "script""&#115cript")
asp常用函数   HtmlCode 
= str
asp常用函数  
End If
asp常用函数
End Function
asp常用函数
asp常用函数    
'****************************************************
asp常用函数'
函数名:Replacehtml
asp常用函数'
作  用:清理html
asp常用函数'
参  数:tstr ----字符串
asp常用函数'
****************************************************
asp常用函数
Public Function Replacehtml(tstr)
asp常用函数  
Dim Str,re
asp常用函数  Str
=Tstr
asp常用函数  
Set re=new RegExp
asp常用函数   re.IgnoreCase 
=True
asp常用函数   re.Global
=True
asp常用函数   re.Pattern
="<(p|\/p|br)>"
asp常用函数   Str
=re.Replace(Str,vbNewLine)
asp常用函数   re.Pattern
="<img.[^>]*src(=| )(.[^>]*)>"
asp常用函数   str
=re.replace(str,"")
asp常用函数   re.Pattern
="<(.[^>]*)>"
asp常用函数   Str
=re.Replace(Str,"")
asp常用函数   
Set Re=Nothing
asp常用函数   Replacehtml
=Str
asp常用函数
End Function
asp常用函数
asp常用函数
asp常用函数
'---------------获取客户端和服务端的一些信息-------------------
asp常用函数

asp常用函数    
'****************************************************
asp常用函数'
函数名:GetIP
asp常用函数'
作  用:获取客户端IP地址
asp常用函数'
返回值:客户端IP地址
asp常用函数'
****************************************************
asp常用函数
    Public Function GetIP()
asp常用函数  
Dim Temp
asp常用函数  Temp 
= Request.ServerVariables("HTTP_X_FORWARDED_FOR")
asp常用函数  
If Temp = "" or isnull(Temp) or isEmpty(Temp) Then Temp = Request.ServerVariables("REMOTE_ADDR")
asp常用函数  
If Instr(Temp,"'")>0 Then Temp="0.0.0.0"
asp常用函数  GetIP 
= Temp
asp常用函数
End Function
asp常用函数
asp常用函数    
'****************************************************
asp常用函数'
函数名:GetBrowser
asp常用函数'
作  用:获取客户端浏览器信息
asp常用函数'
返回值:客户端浏览器信息
asp常用函数'
****************************************************
asp常用函数
    Public Function GetBrowser()
asp常用函数        info
=Request.ServerVariables(HTTP_USER_AGENT) 
asp常用函数  
if Instr(info,"NetCaptor 6.5.0")>0 then
asp常用函数   browser
="NetCaptor 6.5.0"
asp常用函数  
elseif Instr(info,"MyIe 3.1")>0 then
asp常用函数   browser
="MyIe 3.1"
asp常用函数  
elseif Instr(info,"NetCaptor 6.5.0RC1")>0 then
asp常用函数   browser
="NetCaptor 6.5.0RC1"
asp常用函数  
elseif Instr(info,"NetCaptor 6.5.PB1")>0 then
asp常用函数   browser
="NetCaptor 6.5.PB1"
asp常用函数  
elseif Instr(info,"MSIE 5.5")>0 then
asp常用函数   browser
="Internet Explorer 5.5"
asp常用函数  
elseif Instr(info,"MSIE 6.0")>0 then
asp常用函数   browser
="Internet Explorer 6.0"
asp常用函数  
elseif Instr(info,"MSIE 6.0b")>0 then
asp常用函数   browser
="Internet Explorer 6.0b"
asp常用函数  
elseif Instr(info,"MSIE 5.01")>0 then
asp常用函数   browser
="Internet Explorer 5.01"
asp常用函数  
elseif Instr(info,"MSIE 5.0")>0 then
asp常用函数   browser
="Internet Explorer 5.00"
asp常用函数  
elseif Instr(info,"MSIE 4.0")>0 then
asp常用函数   browser
="Internet Explorer 4.01"
asp常用函数  
else
asp常用函数   browser
="其它"
asp常用函数  
end if
asp常用函数
End Function
asp常用函数
asp常用函数    
'****************************************************
asp常用函数'
函数名:GetSystem
asp常用函数'
作  用:获取客户端操作系统
asp常用函数'
返回值:客户端操作系统
asp常用函数'
****************************************************
asp常用函数
    Function GetSystem()
asp常用函数     info
=Request.ServerVariables(HTTP_USER_AGENT) 
asp常用函数  
if Instr(info,"NT 5.1")>0 then
asp常用函数   system
="Windows XP"
asp常用函数  
elseif Instr(info,"Tel")>0 then
asp常用函数   system
="Telport"
asp常用函数  
elseif Instr(info,"webzip")>0 then
asp常用函数   system
="webzip"
asp常用函数  
elseif Instr(info,"flashget")>0 then
asp常用函数   system
="flashget"
asp常用函数  
elseif Instr(info,"offline")>0 then
asp常用函数   system
="offline"
asp常用函数  
elseif Instr(info,"NT 5")>0 then
asp常用函数   system
="Windows 2000"
asp常用函数  
elseif Instr(info,"NT 4")>0 then
asp常用函数   system
="Windows NT4"
asp常用函数  
elseif Instr(info,"98")>0 then
asp常用函数   system
="Windows 98"
asp常用函数  
elseif Instr(info,"95")>0 then
asp常用函数   system
="Windows 95"
asp常用函数  
elseif instr(info,"unix"or instr(info,"linux"or instr(info,"SunOS"or instr(info,"BSD"then
asp常用函数   system
="类Unix"
asp常用函数  
elseif instr(thesoft,"Mac"then
asp常用函数   system
="Mac"
asp常用函数  
else
asp常用函数   system
="其它"
asp常用函数  
end if
asp常用函数
End Function
asp常用函数
asp常用函数
'****************************************************
asp常用函数'
函数名:GetUrl
asp常用函数'
作  用:获取url包括参数
asp常用函数'
返回值:获取url包括参数
asp常用函数'
****************************************************
asp常用函数
Public Function GetUrl()   
asp常用函数  
Dim strTemp     
asp常用函数  strTemp
=Request.ServerVariables("Script_Name")      
asp常用函数  
If  Trim(Request.QueryString)<> "" Then
asp常用函数   strTemp
=strTemp&"?"
asp常用函数   
For Each M_item In Request.QueryString
asp常用函数    strTemp
=strTemp&M_item&"="&Server.UrlEncode(Trim(Request.QueryString(""&M_item&"")))
asp常用函数   
next
asp常用函数  
end if
asp常用函数  GetUrl
=strTemp   
asp常用函数
End Function 
asp常用函数
asp常用函数
'****************************************************
asp常用函数'
函数名:CUrl
asp常用函数'
作  用:获取当前页面URL的函数
asp常用函数'
返回值:当前页面URL的函数
asp常用函数'
****************************************************
asp常用函数
Function CUrl()
asp常用函数  Domain_Name 
= LCase(Request.ServerVariables("Server_Name"))
asp常用函数  Page_Name 
= LCase(Request.ServerVariables("Script_Name"))
asp常用函数  Quary_Name 
= LCase(Request.ServerVariables("Quary_String"))
asp常用函数  
If Quary_Name ="" Then
asp常用函数   CUrl 
= "http://"&Domain_Name&Page_Name
asp常用函数  
Else
asp常用函数   CUrl 
= "http://"&Domain_Name&Page_Name&"?"&Quary_Name
asp常用函数  
End If
asp常用函数
End Function
asp常用函数
asp常用函数    
'****************************************************
asp常用函数'
函数名:GetExtend
asp常用函数'
作  用:取得文件扩展名
asp常用函数'
参  数:filename ----文件名
asp常用函数'
****************************************************
asp常用函数
Public Function GetExtend(filename)
asp常用函数  
dim tmp
asp常用函数  
if filename<>"" then
asp常用函数   tmp
=mid(filename,instrrev(filename,".")+1,len(filename)-instrrev(filename,"."))
asp常用函数   tmp
=LCase(tmp)
asp常用函数   
if instr(1,tmp,"asp")>0 or instr(1,tmp,"php")>0 or instr(1,tmp,"php3")>0 or instr(1,tmp,"aspx")>0 then
asp常用函数    getextend
="txt"
asp常用函数   
else
asp常用函数    getextend
=tmp
asp常用函数   
end if
asp常用函数  
else
asp常用函数   getextend
=""
asp常用函数  
end if
asp常用函数
End Function
asp常用函数
'------------------数据库的操作-----------------------
asp常用函数

asp常用函数    
'****************************************************
asp常用函数'
函数名:CheckExist
asp常用函数'
作  用:检测某个表中某个字段是否存在某个内容
asp常用函数'
参  数:table        ----表名
asp常用函数'
       fieldname    ----字段名
asp常用函数'
       fieldcontent ----字段内容
asp常用函数'
       isblur       ----是否模糊匹配
asp常用函数'
返回值:false不存在,true存在
asp常用函数'
****************************************************
asp常用函数
Function CheckExist(table,fieldname,fieldcontent,isblur)
asp常用函数  CheckExist
=false
asp常用函数  
If isblur=1 Then
asp常用函数            
set rsCheckExist=conn.execute("select * from "&table&" where "&fieldname&" like '%"&fieldcontent&"%'")
asp常用函数  
else
asp常用函数   
set rsCheckExist=conn.execute("select * from "&table&" where "&fieldname&"= '"&fieldcontent&"'")
asp常用函数  
End if
asp常用函数  
if not (rsCheckExist.eof and rsCheckExist.bof) then CheckExist=true
asp常用函数  rsCheckExist.close
asp常用函数  
set rsCheckExist=nothing
asp常用函数
End Function
asp常用函数
asp常用函数
'****************************************************
asp常用函数'
函数名:GetNum
asp常用函数'
作  用:检测某个表某个字段的数量或最大值或最小值
asp常用函数'
参  数:table      ----表名
asp常用函数'
       fieldname  ----字段名
asp常用函数'
       resulttype ----还回结果(count/max/min)
asp常用函数'
       args       ----附加参加(order by asp常用函数)
asp常用函数'
返回值:数值
asp常用函数'
****************************************************
asp常用函数
Function GetNum(table,fieldname,resulttype,args)
asp常用函数  GetFieldContentNum
=0
asp常用函数  
if fieldname="" then fieldname="*"
asp常用函数  sqlGetFieldContentNum
="select "&resulttype&"("&fieldname&") from "&table& args
asp常用函数  
set rsGetFieldContentNum=conn.execute(sqlGetFieldContentNum) 
asp常用函数  
if not (rsGetFieldContentNum.eof and rsGetFieldContentNum.bof) then GetFieldContentNum=rsGetFieldContentNum(0)
asp常用函数  rsGetFieldContentNum.close
asp常用函数  
set rsGetFieldContentNum=nothing
asp常用函数
End Function
asp常用函数
asp常用函数
'****************************************************
asp常用函数'
函数名:UpdateValue
asp常用函数'
作  用:更新表中某字段某内容的值
asp常用函数'
参  数:table      ----表名
asp常用函数'
        fieldname  ----字段名
asp常用函数'
        fieldvalue ----更新后的值
asp常用函数'
        id         ----id
asp常用函数'
        url        -------更新后转向地址
asp常用函数'
返回值:无
asp常用函数'
****************************************************
asp常用函数
Public Function UpdateValue(table,fieldname,fieldvalue,id,url)
asp常用函数  conn.Execute(
"update "&table&" set "&fieldname&"="&fieldvalue&" where id="&CLng(trim(id)))
asp常用函数  
if url<>"" then response.redirect url
asp常用函数
End Function
asp常用函数
asp常用函数
'---------------服务端信息和操作-----------------------
asp常用函数

asp常用函数    
'****************************************************
asp常用函数'
函数名:GetFolderSize
asp常用函数'
作  用:计算某个文件夹的大小
asp常用函数'
参  数:FileName ----文件夹路径及文件夹名称
asp常用函数'
返回值:数值
asp常用函数'
****************************************************
asp常用函数
Public Function GetFolderSize(Folderpath)
asp常用函数  
dim fso,d,size,showsize
asp常用函数  
set fso=server.createobject("scripting.filesystemobject")   
asp常用函数  drvpath
=server.mappath(Folderpath)  
asp常用函数  
if fso.FolderExists(drvpath) Then
asp常用函数   
set d=fso.getfolder(drvpath)   
asp常用函数   size
=d.size
asp常用函数   GetFolderSize
=FormatSize(size)
asp常用函数  
Else
asp常用函数            GetFolderSize
=Folderpath&"文件夹不存在"
asp常用函数  
End If 
asp常用函数
End Function
asp常用函数
asp常用函数
'****************************************************
asp常用函数'
函数名:GetFileSize
asp常用函数'
作  用:计算某个文件的大小
asp常用函数'
参  数:FileName ----文件路径及文件名
asp常用函数'
返回值:数值
asp常用函数'
****************************************************
asp常用函数
Public Function GetFileSize(FileName)
asp常用函数  
Dim fso,drvpath,d,size,showsize
asp常用函数  
set fso=server.createobject("scripting.filesystemobject")
asp常用函数  filepath
=server.mappath(FileName)
asp常用函数  
if fso.FileExists(filepath) then
asp常用函数   
set d=fso.getfile(filepath) 
asp常用函数   size
=d.size
asp常用函数   GetFileSize
=FormatSize(size)
asp常用函数        
Else
asp常用函数      GetFileSize
=FileName&"文件不存在"
asp常用函数        
End If
asp常用函数  
set fso=nothing
asp常用函数
End Function
asp常用函数
asp常用函数
'****************************************************
asp常用函数'
函数名:IsObjInstalled
asp常用函数'
作  用:检查组件是否安装
asp常用函数'
参  数:strClassString ----组件名称
asp常用函数'
返回值:false不存在,true存在
asp常用函数'
****************************************************
asp常用函数
Public Function IsObjInstalled(strClassString)
asp常用函数  
On Error Resume Next
asp常用函数  IsObjInstalled
=False
asp常用函数  Err
=0
asp常用函数  
Dim xTestObj
asp常用函数  
Set xTestObj=Server.CreateObject(strClassString)
asp常用函数  
If 0=Err Then IsObjInstalled=True
asp常用函数  
Set xTestObj=Nothing
asp常用函数  Err
=0
asp常用函数
End Function
asp常用函数
asp常用函数
'****************************************************
asp常用函数'
函数名:SendMail
asp常用函数'
作  用:用Jmail组件发送邮件
asp常用函数'
参  数:ServerAddress ----服务器地址
asp常用函数'
       AddRecipient  ----收信人地址
asp常用函数'
       Subject       ----主题
asp常用函数'
       Body          ----信件内容
asp常用函数'
       Sender        ----发信人地址
asp常用函数'
****************************************************
asp常用函数
Public function SendMail(MailServerAddress,AddRecipient,Subject,Body,Sender,MailFrom)
asp常用函数  
on error resume next
asp常用函数  
Dim JMail
asp常用函数  
Set JMail=Server.CreateObject("JMail.SMTPMail")
asp常用函数  
if err then
asp常用函数   SendMail
= "没有安装JMail组件"
asp常用函数   err.clear
asp常用函数   
exit function
asp常用函数  
end if
asp常用函数  JMail.Logging
=True
asp常用函数  JMail.Charset
="gb2312"
asp常用函数  JMail.ContentType 
= "text/html"
asp常用函数  JMail.ServerAddress
=MailServerAddress
asp常用函数  JMail.AddRecipient
=AddRecipient
asp常用函数  JMail.Subject
=Subject
asp常用函数  JMail.Body
=MailBody
asp常用函数  JMail.Sender
=Sender
asp常用函数  JMail.From 
= MailFrom
asp常用函数  JMail.Priority
=1
asp常用函数  JMail.Execute 
asp常用函数  
Set JMail=nothing 
asp常用函数  
if err then 
asp常用函数   SendMail
=err.description
asp常用函数   err.clear
asp常用函数  
else
asp常用函数   SendMail
="OK"
asp常用函数  
end if
asp常用函数
end function
asp常用函数
asp常用函数    
'****************************************************
asp常用函数'
函数名:ResponseCookies
asp常用函数'
作  用:写入COOKIES
asp常用函数'
参  数:Key ----cookie名
asp常用函数'
        value ----cookie值
asp常用函数'
        expires ---- cookie过期时间
asp常用函数'
****************************************************
asp常用函数
Public Function ResponseCookies(Key,Value,Expires)
asp常用函数  DomainPath
=Left(Request.ServerVariables("script_name"),inStrRev(Request.ServerVariables("script_name"),"/"))
asp常用函数  Response.Cookies(Key)
=""&Value&""
asp常用函数  
if Expires<>0 then Response.Cookies(Key).Expires=date+Expires
asp常用函数  Response.Cookies(Key).Path
=DomainPath
asp常用函数
End Function
asp常用函数
asp常用函数    
'****************************************************
asp常用函数'
函数名:CleanCookies
asp常用函数'
作  用:清除COOKIES
asp常用函数'
****************************************************
asp常用函数
Public Function CleanCookies()
asp常用函数  DomainPath
=Left(Request.ServerVariables("script_name"),inStrRev(Request.ServerVariables("script_name"),"/"))
asp常用函数  
For Each objCookie In Request.Cookies
asp常用函数   Response.Cookies(objCookie)
= ""
asp常用函数   Response.Cookies(objCookie).Path
=DomainPath
asp常用函数  
Next
asp常用函数
End Function
asp常用函数
asp常用函数
'****************************************************
asp常用函数'
函数名:GetTimeOver
asp常用函数'
作  用:清除COOKIES
asp常用函数'
参  数:flag ---显示时间单位1=秒,否则毫秒
asp常用函数'
****************************************************
asp常用函数
Public Function GetTimeOver(flag)
asp常用函数  
Dim EndTime
asp常用函数  
If flag = 1 Then
asp常用函数   EndTime
=FormatNumber(Timer() - StartTime, 6true)
asp常用函数   getTimeOver 
= " 本页执行时间: " & EndTime & " 秒"
asp常用函数  
Else
asp常用函数   EndTime
=FormatNumber((Timer() - StartTime) * 10003true)
asp常用函数   getTimeOver 
=" 本页执行时间: " & EndTime & " 毫秒"
asp常用函数  
End If
asp常用函数
End function
asp常用函数
'-----------------系列格式化------------------------
asp常用函数

asp常用函数
'****************************************************
asp常用函数'
函数名:FormatSize
asp常用函数'
作  用:大小格式化
asp常用函数'
参  数:size ----要格式化的大小
asp常用函数'
****************************************************
asp常用函数
Public Function FormatSize(dsize)
asp常用函数  
if dsize>=1073741824 then
asp常用函数   FormatSize
=Formatnumber(dsize/1073741824,2& " GB"
asp常用函数  
elseif dsize>=1048576 then
asp常用函数   FormatSize
=Formatnumber(dsize/1048576,2& " MB"
asp常用函数  
elseif dsize>=1024 then
asp常用函数   FormatSize
=Formatnumber(dsize/1024,2& " KB"
asp常用函数  
else
asp常用函数   FormatSize
=dsize & " Byte"
asp常用函数  
end if
asp常用函数
End Function
asp常用函数
asp常用函数
'****************************************************
asp常用函数'
函数名:FormatTime
asp常用函数'
作  用:时间格式化
asp常用函数'
参  数:DateTime ----要格式化的时间
asp常用函数'
       Format   ----格式的形式
asp常用函数'
****************************************************
asp常用函数
Public Function FormatTime(DateTime,Format) 
asp常用函数  
select case Format
asp常用函数  
case "1"
asp常用函数    FormatTime
=""&year(DateTime)&""&month(DateTime)&""&day(DateTime)&""
asp常用函数  
case "2"
asp常用函数    FormatTime
=""&month(DateTime)&""&day(DateTime)&""
asp常用函数  
case "3" 
asp常用函数    FormatTime
=""&year(DateTime)&"/"&month(DateTime)&"/"&day(DateTime)&""
asp常用函数  
case "4"
asp常用函数    FormatTime
=""&month(DateTime)&"/"&day(DateTime)&""
asp常用函数  
case "5"
asp常用函数    FormatTime
=""&month(DateTime)&""&day(DateTime)&""&FormatDateTime(DateTime,4)&""
asp常用函数  
case "6"
asp常用函数     temp
="周日,周一,周二,周三,周四,周五,周六"
asp常用函数     temp
=split(temp,","
asp常用函数     FormatTime
=temp(Weekday(DateTime)-1)
asp常用函数  
case Else
asp常用函数  FormatTime
=DateTime
asp常用函数  
end select
asp常用函数
End Function
asp常用函数
asp常用函数
'----------------------杂项---------------------
asp常用函数
    '****************************************************
asp常用函数'
函数名:Zodiac
asp常用函数'
作  用:取得生消
asp常用函数'
参  数:birthday ----生日
asp常用函数'
****************************************************
asp常用函数
public Function Zodiac(birthday)
asp常用函数  
if IsDate(birthday) then
asp常用函数   birthyear
=year(birthday)
asp常用函数   ZodiacList
=array("","","","","","","","","","","","")  
asp常用函数   Zodiac
=ZodiacList(birthyear mod 12)
asp常用函数  
end if
asp常用函数
End Function
asp常用函数
asp常用函数    
'****************************************************
asp常用函数'
函数名:Constellation
asp常用函数'
作  用:取得星座
asp常用函数'
参  数:birthday ----生日
asp常用函数'
****************************************************
asp常用函数
public Function Constellation(birthday)
asp常用函数  
if IsDate(birthday) then
asp常用函数   ConstellationMon
=month(birthday)
asp常用函数   ConstellationDay
=day(birthday)
asp常用函数   
if Len(ConstellationMon)<2 then ConstellationMon="0"&ConstellationMon
asp常用函数   
if Len(ConstellationDay)<2 then ConstellationDay="0"&ConstellationDay
asp常用函数   MyConstellation
=ConstellationMon&ConstellationDay
asp常用函数   
if MyConstellation < 0120 then
asp常用函数    constellation
="<img src=images/Constellation/g.gif title='魔羯座 Capricorn'>"
asp常用函数   
elseif MyConstellation < 0219 then
asp常用函数    constellation
="<img src=images/Constellation/h.gif title='水瓶座 Aquarius'>"
asp常用函数   
elseif MyConstellation < 0321 then
asp常用函数    constellation
="<img src=images/Constellation/i.gif title='双鱼座 Pisces'>"
asp常用函数   
elseif MyConstellation < 0420 then
asp常用函数    constellation
="<img src=images/Constellation/^.gif title='白羊座 Aries'>"
asp常用函数   
elseif MyConstellation < 0521 then
asp常用函数    constellation
="<img src=images/Constellation/_.gif title='金牛座 Taurus'>"
asp常用函数   
elseif MyConstellation < 0622 then
asp常用函数    constellation
="<img src=images/Constellation/`.gif title='双子座 Gemini'>"
asp常用函数   
elseif MyConstellation < 0723 then
asp常用函数    constellation
="<img src=images/Constellation/a.gif title='巨蟹座 Cancer'>"
asp常用函数   
elseif MyConstellation < 0823 then
asp常用函数    constellation
="<img src=images/Constellation/b.gif title='狮子座 Leo'>"
asp常用函数   
elseif MyConstellation < 0923 then
asp常用函数    constellation
="<img src=images/Constellation/c.gif title='处女座 Virgo'>"
asp常用函数   
elseif MyConstellation < 1024 then
asp常用函数    constellation
="<img src=images/Constellation/d.gif title='天秤座 Libra'>"
asp常用函数   
elseif MyConstellation < 1122 then
asp常用函数    constellation
="<img src=images/Constellation/e.gif title='天蝎座 Scorpio'>"
asp常用函数   
elseif MyConstellation < 1222 then
asp常用函数    constellation
="<img src=images/Constellation/f.gif title='射手座 Sagittarius'>"
asp常用函数   
elseif MyConstellation > 1221 then
asp常用函数    constellation
="<img src=images/Constellation/g.gif title='魔羯座 Capricorn'>"
asp常用函数   
end if
asp常用函数  
end if
asp常用函数
End Function
asp常用函数
asp常用函数
'=================================================
asp常用函数'
函数名:autopage
asp常用函数'
作  用:长文章自动分页
asp常用函数'
参  数:id,content,urlact
asp常用函数'
=================================================
asp常用函数
Function AutoPage(content,paramater,pagevar)
asp常用函数   contentStr
=split(content,pagevar) 
asp常用函数   pagesize
=ubound(contentStr)
asp常用函数   
if pagesize>0 then
asp常用函数    
If Int(Request("page"))="" or Int(Request("page"))=0 Then 
asp常用函数     pageNum
=1 
asp常用函数    
Else 
asp常用函数     pageNum
=Request("page"
asp常用函数    
End if 
asp常用函数    
if pageNum-1<=pagesize then
asp常用函数     AutoPage
=AutoPage&contentStr(pageNum-1)
asp常用函数     AutoPage
=AutoPage&"<div style=""margin-top:10px;text-align:right;padding-right:15px;""><font color=blue>页码:</font><font color=red>"
asp常用函数     
For i=0 to pagesize 
asp常用函数      
if i=pageNum-1 then 
asp常用函数       AutoPage
=AutoPage&"[<font color=red>"&i+1&"</font>] "
asp常用函数      
else 
asp常用函数       
if instr(paramater,"?")>0 then
asp常用函数        AutoPage
=AutoPage&"<a href="""&paramater&"&page="&i+1&""">["&(i+1)&"]</a>"
asp常用函数       
else
asp常用函数        AutoPage
=AutoPage&"<a href="""&paramater&"?page="&i+1&""">["&(i+1)&"]</a>"
asp常用函数       
end if
asp常用函数      
end if  
asp常用函数     
Next 
asp常用函数     AutoPage
=AutoPage&"</font></div>"
asp常用函数    
else
asp常用函数     AutoPage
=AutoPage&"非法操作!页号超出!<a href=javascript:history.back(-1)><u>返回</u></a>"
asp常用函数    
end if
asp常用函数   
Else
asp常用函数    AutoPage
=content
asp常用函数   
end if
asp常用函数
End Function
asp常用函数
End Class

 

相关文章: