天枫常用的ASP函数封装如下
2018-09-06 11:34
  复制代码 代码如下:
<% 
------------------------------------- 
天枫ASPclassv1.0,集常用asp函数于一体 
天枫版权所有
所有功能函数名如下: 
StrLength(str)取得字符串长度 
CutStr(str,strlen)字符串长度切割 
CheckIsEmpty(tstr)检测是否为空 
isInteger(para)整数检验 
CheckName(str)名字字符校验 
CheckPassword(str)密码检验 
CheckEmail(email)邮箱格式检验 
Alert(msg,goUrl)弹出对话框提示 
GoBack(Str1,Str2,isback)出错信息提示 
Suc(str1,str2,url)操作成功信息提示 
ChkPost()检测是否站外提交表单 
PSql()防止sql注入 
FiltrateHtmlCode(Str)防止生成HTML 
HtmlCode(str)过滤HTML 
Replacehtml(tstr)清滤HTML 
GetIP()获取客户端IP 
GetBrowser获取客户端浏览器信 
GetSystem获取客户端操作系统 
GetUrl()获取当前页面URL包含参数 
CUrl()获取当前页面URL 
GetExtend取得文件扩展名 
CheckExist(table,fieldname,fieldcontent,isblur)检测某个表中某个字段的内容是否存在 
GetNum(table,fieldname,resulttype,args)检测某个表某个字段有多少条,最大值,最小值等 
GetFolderSize(Folderpath)计算某个文件夹的大小 
GetFileSize(Filename)计算某个文件的大小 
IsObjInstalled(strClassString)检测组件是否安装 
SendMailJMAIL发送邮件 
ResponseCookies写入cookies 
CleanCookies清除cookies 
GetTimeover取得程序页面执行时间 
FormatSize大小格式化 
FormatTime时间格式化 
Zodiac取得生肖 
Constellation取得星座 
------------------------------------- 
ClassCls_fun 
--------字符处理-------------------------- 
**************************************************** 
函数名:StrLength 
作用:取得字符串长度(汉字为2) 
参数:str----字符串内容 
返回值:字符串长度 
**************************************************** 
PublicfunctionStrLength(str) 
DimRep,lens,i 
Setrep=newregexp 
rep.Global=true 
rep.IgnoreCase=true 
rep.Pattern=[\u4E00-\u9FA5\uF900-\uFA2D] 
Foreachiinrep.Execute(str) 
lens=lens+1 
Next 
SetRep=Nothing 
lens=lens+len(str) 
strLength=lens 
EndFunction 
**************************************************** 
函数名:CutStr 
作用:字符串长度切割,超过显示省略号 
参数:str----字符串内容 
strlen------要显示的长度 
返回值:切割后字符串内容 
**************************************************** 
PublicFunctionCutStr(str,strlen) 
Diml,t,i,c 
Ifstr=Then 
cutstr= 
ExitFunction 
EndIf 
str=Replace(Replace(Replace(Replace(Replace(str,,),",Chr(34)),>,>),<,<),|,) 
l=Len(str) 
t=0 
Fori=1Tol 
c=Abs(Asc(Mid(str,i,1))) 
Ifc>255Then 
t=t+2 
Else 
t=t+1 
EndIf 
Ift>=strlenThen 
cutstr=Left(str,i)&... 
ExitFor 
Else 
cutstr=str 
EndIf 
Next 
cutstr=Replace(Replace(Replace(Replace(replace(cutstr,,),Chr(34),"),>,>),<,<),,|) 
EndFunction 
--------------系列验证---------------------------- 
**************************************************** 
函数名:CheckIsEmpty 
作用:检查是否为空 
参数:tstr----字符串 
返回值:true不为空,false为空 
**************************************************** 
PublicFunctionCheckIsEmpty(tstr) 
CheckIsEmpty=false 
IfIsNull(tstr)orTstr=ThenExitFunction 
DimStr,re 
Str=Tstr 
Setre=newRegExp 
re.IgnoreCase=True 
re.Global=True 
str=Replace(str,vbNewLine,) 
str=Replace(str,Chr(9),) 
str=Replace(str,,) 
str=Replace(str,,) 
re.Pattern=<img(.[^>]*)> 
str=re.Replace(Str,94kk) 
re.Pattern=<(.[^>]*)> 
Str=re.Replace(Str,) 
SetRe=Nothing 
IfStr<>ThenCheckIsEmpty=true 
EndFunction 
**************************************************** 
函数名:isInteger 
作用:整数检验 
参数:tstr----字符 
返回值:true是整数,false不是整数 
**************************************************** 
PublicfunctionisInteger(para) 
onerrorresumeNext 
Dimstr 
Diml,i 
IfisNUll(para)then 
isInteger=false 
exitfunction 
Endif 
str=cstr(para) 
Iftrim(str)=then 
isInteger=false 
exitfunction 
Endif 
l=len(str) 
Fori=1tol 
Ifmid(str,i,1)>9ormid(str,i,1)<0then 
isInteger=false 
exitfunction 
Endif 
Next 
isInteger=true 
Iferr.number<>0thenerr.clear 
EndFunction 
**************************************************** 
函数名:CheckName 
作用:名字字符检验 
参数:str----字符串 
返回值:true无误,false有误 
**************************************************** 
PublicFunctionCheckName(Str) 
Checkname=true 
DimRep,pass 
SetRep=NewRegExp 
Rep.Global=True 
Rep.IgnoreCase=True 
匹配字母、数字、下划线、汉字且必须以字母或下划线或汉字开始 
Rep.Pattern=^[a-zA-Z_u4e00-\u9fa5][\w\u4e00-\u9fa5]+$ 
Setpass=Rep.Execute(Str) 
SetRep=Nothing 
EndFunction 
**************************************************** 
函数名:CheckPassword 
作用:密码检验 
参数:str----字符串 
返回值:true无误,false有误 
**************************************************** 
PublicFunctionCheckPassword(Str) 
Dimpass 
CheckPassword=true 
IfStr<>Then 
DimRep 
SetRep=NewRegExp 
Rep.Global=True 
Rep.IgnoreCase=True 
匹配字母、数字、下划线、点号 
Rep.Pattern=[a-zA-Z0-9_\.]+$ 
Pass=rep.Test(Str) 
SetRep=nothing 
IfnotPassThenCheckPassword=false 
EndIf 
EndFunction 
**************************************************** 
函数名:CheckEmail 
作用:邮箱格式检测 
参数:str----Email地址 
返回值:true无误,false有误 
**************************************************** 
PublicfunctionCheckEmail(email) 
CheckEmail=true 
DimRep 
SetRep=newRegExp 
rep.pattern=([\.a-zA-Z0-9_-]){2,10}@([a-zA-Z0-9_-]){2,10}(\.([a-zA-Z0-9]){2,}){1,4}$ 
pass=rep.Test(email) 
SetRep=Nothing 
IfnotpassThenCheckEmail=false 
Endfunction 
--------------信息提示---------------------------- 
**************************************************** 
函数名:Alert 
作用:弹出对话框提示 
参数:msg----对话框信息 
gourl----提示后转向哪里 
返回值:无 
**************************************************** 
PublicFunctionAlert(msg,goUrl) 
msg=replace(msg,,\) 
IfgoUrl=Then 
goUrl=history.go(-1); 
Else 
goUrl=window.location.href=&goUrl& 
EndIF 
Response.Write(<scriptlanguage=JavaScripttype=text/javascript>&vbNewLine&alert(&msg&);&goUrl&vbNewLine&</script>) 
Response.End 
EndFunction 
**************************************************** 
函数名:GoBack 
作用:错误信息提示 
参数:str1----信息提示标题 
str2----信息提示内容 
isback----是否显示返回 
返回值:无 
**************************************************** 
PublicFunctionGoBack(Str1,Str2,isback) 
IfStr1=ThenStr1=错误信息 
IfStr2=ThenStr2=请填写完整必填项目 
Ifisback=Then 
Str2=Str2&<ahref=javascript:history.go(-1)>返回重填</a></li> 
else 
Str2=Str2 
endif 
Response.Write<divstyle=margin-left:5px;border:1pxsolid#0066cc;width:98%><divstyle=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><divstyle=line-height:50px;background:#F7F7F7;vertical-align:middle;font-size:14px;width:100%><divstyle=color:red;font:50px/50px宋体;float:left;width:5%>×</div><divstyle=margin-top:8px;float:right;width:90%;text-align:left;padding-left:3px;>&str2&</div></div></div> 
response.end 
EndFunction 
**************************************************** 
函数名:Suc 
作用:成功提示信息 
参数:str1----信息提示标题 
str2----信息提示内容 
url----返回地址 
返回值:无 
**************************************************** 
PublicFunctionSuc(str1,str2,url) 
Ifstr1=ThenStr1=操作成功 
Ifstr2=ThenStr2=成功的完成这次操作! 
Ifurl=Thenurl=javascript:history.go(-1) 
str2=str2&<ahref=&url&>返回继续管理</a> 
Response.Write<divstyle=margin-left:5px;border:1pxsolid#0066cc;width:98%><divstyle=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><divstyle=line-height:50px;background:#F7F7F7;vertical-align:middle;font-size:14px;width:100%><divstyle=color:red;font:50px/50px宋体;float:left;width:5%>√</div><divstyle=margin-top:8px;float:right;width:90%;text-align:left;padding-left:3px;>&str2&</div></div></div> 
EndFunction 
--------------安全处理---------------------------- 
**************************************************** 
函数名:ChkPost 
作用:禁止站外提交表单 
返回值:true站内提交,flase站外提交 
**************************************************** 
PublicFunctionChkPost() 
Dimurl1,url2 
chkpost=true 
url1=Cstr(Request.ServerVariables(HTTP_REFERER)) 
url2=Cstr(Request.ServerVariables(SERVER_NAME)) 
IfMid(url1,8,Len(url2))<>url2Then 
chkpost=false 
exitfunction 
EndIf 
Endfunction 
**************************************************** 
函数名:PSql 
作用:防止SQL注入 
返回值:为空则无注入,不为空则注入并返回注入的字符 
**************************************************** 
publicFunctionPSql() 
Psql= 
badwords=防防;防and防exec防insert防select防update防delete防count防*防%防chr防mid防master防truncate防char防declare防 
badword=split(badwords,防) 
IfRequest.Form<>Then 
ForEachTF_PostInRequest.Form 
Fori=0ToUbound(badword) 
IfInstr(LCase(Request.Form(TF_Post)),badword(i))>0Then 
Psql=badword(i) 
exitfunction 
EndIf 
Next 
Next 
EndIf 
IfRequest.QueryString<>Then 
ForEachTF_GetInRequest.QueryString 
Fori=0ToUbound(badword) 
IfInstr(LCase(Request.QueryString(TF_Get)),badword(i))>0Then 
Psql=badword(i) 
exitfunction 
EndIf 
Next 
Next 
EndIf 
EndFunction 
**************************************************** 
函数名:FiltrateHtmlCode 
作用:防止生成html代码 
参数:str----字符串 
**************************************************** 
PublicFunctionFiltrateHtmlCode(Str) 
IfNotisnull(str)Andstr<>then 
Str=Replace(Str,Chr(9),) 
Str=replace(Str,,|) 
Str=replace(Str,chr(39),') 
Str=replace(Str,<,<) 
Str=replace(Str,>,>) 
Str=Replace(str,CHR(13),) 
Str=Replace(str,CHR(10),) 
FiltrateHtmlCode=Str 
EndIf 
EndFunction 
**************************************************** 
函数名:HtmlCode 
作用:过滤Html标签 
参数:str----字符串 
**************************************************** 
PublicfunctionHtmlCode(str) 
IfNotisnull(str)Andstr<>then 
str=replace(str,>,>) 
str=replace(str,<,<) 
str=Replace(str,CHR(32),) 
str=Replace(str,CHR(9),) 
str=Replace(str,CHR(34),") 
str=Replace(str,CHR(39),') 
str=Replace(str,CHR(13),) 
str=Replace(str,CHR(10),) 
str=Replace(str,script,script) 
HtmlCode=str 
EndIf 
EndFunction 
**************************************************** 
函数名:Replacehtml 
作用:清理html 
参数:tstr----字符串 
**************************************************** 
PublicFunctionReplacehtml(tstr) 
DimStr,re 
Str=Tstr 
Setre=newRegExp 
re.IgnoreCase=True 
re.Global=True 
re.Pattern=<(p\/pbr)> 
Str=re.Replace(Str,vbNewLine) 
re.Pattern=<img.[^>]*src(=)(.[^>]*)> 
str=re.replace(str,[img]$2[/img]) 
re.Pattern=<(.[^>]*)> 
Str=re.Replace(Str,) 
SetRe=Nothing 
Replacehtml=Str 
EndFunction 
---------------获取客户端和服务端的一些信息------------------- 
**************************************************** 
函数名:GetIP 
作用:获取客户端IP地址 
返回值:客户端IP地址 
**************************************************** 
PublicFunctionGetIP() 
DimTemp 
Temp=Request.ServerVariables(HTTP_X_FORWARDED_FOR) 
IfTemp=orisnull(Temp)orisEmpty(Temp)ThenTemp=Request.ServerVariables(REMOTE_ADDR) 
IfInstr(Temp,)>0ThenTemp=0.0.0.0 
GetIP=Temp 
EndFunction 
**************************************************** 
函数名:GetBrowser 
作用:获取客户端浏览器信息 
返回值:客户端浏览器信息 
**************************************************** 
PublicFunctionGetBrowser() 
info=Request.ServerVariables(HTTP_USER_AGENT) 
ifInstr(info,NetCaptor6.5.0)>0then 
browser=NetCaptor6.5.0 
elseifInstr(info,MyIe3.1)>0then 
browser=MyIe3.1 
elseifInstr(info,NetCaptor6.5.0RC1)>0then 
browser=NetCaptor6.5.0RC1 
elseifInstr(info,NetCaptor6.5.PB1)>0then 
browser=NetCaptor6.5.PB1 
elseifInstr(info,MSIE5.5)>0then 
browser=InternetExplorer5.5 
elseifInstr(info,MSIE6.0)>0then 
browser=InternetExplorer6.0 
elseifInstr(info,MSIE6.0b)>0then 
browser=InternetExplorer6.0b 
elseifInstr(info,MSIE5.01)>0then 
browser=InternetExplorer5.01 
elseifInstr(info,MSIE5.0)>0then 
browser=InternetExplorer5.00 
elseifInstr(info,MSIE4.0)>0then 
browser=InternetExplorer4.01 
else 
browser=其它 
endif 
EndFunction 
**************************************************** 
函数名:GetSystem 
作用:获取客户端操作系统 
返回值:客户端操作系统 
**************************************************** 
FunctionGetSystem() 
info=Request.ServerVariables(HTTP_USER_AGENT) 
ifInstr(info,NT5.1)>0then 
system=WindowsXP 
elseifInstr(info,Tel)>0then 
system=Telport 
elseifInstr(info,webzip)>0then 
system=webzip 
elseifInstr(info,flashget)>0then 
system=flashget 
elseifInstr(info,offline)>0then 
system=offline 
elseifInstr(info,NT5)>0then 
system=Windows2000 
elseifInstr(info,NT4)>0then 
system=WindowsNT4 
elseifInstr(info,98)>0then 
system=Windows98 
elseifInstr(info,95)>0then 
system=Windows95 
elseifinstr(info,unix)orinstr(info,linux)orinstr(info,SunOS)orinstr(info,BSD)then 
system=类Unix 
elseifinstr(thesoft,Mac)then 
system=Mac 
else 
system=其它 
endif 
EndFunction 
**************************************************** 
函数名:GetUrl 
作用:获取url包括参数 
返回值:获取url包括参数 
**************************************************** 
PublicFunctionGetUrl() 
DimstrTemp 
strTemp=Request.ServerVariables(Script_Name) 
IfTrim(Request.QueryString)<>Then 
strTemp=strTemp&? 
ForEachM_itemInRequest.QueryString 
strTemp=strTemp&M_item&=&Server.UrlEncode(Trim(Request.QueryString(&M_item&))) 
next 
endif 
GetUrl=strTemp 
EndFunction 
**************************************************** 
函数名:CUrl 
作用:获取当前页面URL的函数 
返回值:当前页面URL的函数 
**************************************************** 
FunctionCUrl() 
Domain_Name=LCase(Request.ServerVariables(Server_Name)) 
Page_Name=LCase(Request.ServerVariables(Script_Name)) 
Quary_Name=LCase(Request.ServerVariables(Quary_String)) 
IfQuary_Name=Then 
CUrl=
Else 
CUrl=
EndIf 
EndFunction 
**************************************************** 
函数名:GetExtend 
作用:取得文件扩展名 
参数:filename----文件名 
**************************************************** 
PublicFunctionGetExtend(filename) 
dimtmp 
iffilename<>then 
tmp=mid(filename,instrrev(filename,.)+1,len(filename)-instrrev(filename,.)) 
tmp=LCase(tmp) 
ifinstr(1,tmp,asp)>0orinstr(1,tmp,php)>0orinstr(1,tmp,php3)>0orinstr(1,tmp,aspx)>0then 
getextend=txt 
else 
getextend=tmp 
endif 
else 
getextend= 
endif 
EndFunction 
------------------数据库的操作----------------------- 
**************************************************** 
函数名:CheckExist 
作用:检测某个表中某个字段是否存在某个内容 
参数:table----表名 
fieldname----字段名 
fieldcontent----字段内容 
isblur----是否模糊匹配 
返回值:false不存在,true存在 
**************************************************** 
FunctionCheckExist(table,fieldname,fieldcontent,isblur) 
CheckExist=false 
Ifisblur=1Then 
setrsCheckExist=conn.execute(select*from&table&where&fieldname&like%&fieldcontent&%) 
else 
setrsCheckExist=conn.execute(select*from&table&where&fieldname&=&fieldcontent&) 
Endif 
ifnot(rsCheckExist.eofandrsCheckExist.bof)thenCheckExist=true 
rsCheckExist.close 
setrsCheckExist=nothing 
EndFunction 
**************************************************** 
函数名:GetNum 
作用:检测某个表某个字段的数量或最大值或最小值 
参数:table----表名 
fieldname----字段名 
resulttype----还回结果(count/max/min) 
args----附加参加(orderby...) 
返回值:数值 
**************************************************** 
FunctionGetNum(table,fieldname,resulttype,args) 
GetFieldContentNum=0 
iffieldname=thenfieldname=* 
sqlGetFieldContentNum=select&resulttype&(&fieldname&)from&table&args 
setrsGetFieldContentNum=conn.execute(sqlGetFieldContentNum) 
ifnot(rsGetFieldContentNum.eofandrsGetFieldContentNum.bof)thenGetFieldContentNum=rsGetFieldContentNum(0) 
rsGetFieldContentNum.close 
setrsGetFieldContentNum=nothing 
EndFunction 
**************************************************** 
函数名:UpdateValue 
作用:更新表中某字段某内容的值 
参数:table----表名 
fieldname----字段名 
fieldvalue----更新后的值 
id----id 
url-------更新后转向地址 
返回值:无 
**************************************************** 
PublicFunctionUpdateValue(table,fieldname,fieldvalue,id,url) 
conn.Execute(update&table&set&fieldname&=&fieldvalue&whereid=&CLng(trim(id))) 
ifurl<>thenresponse.redirecturl 
EndFunction 
---------------服务端信息和操作----------------------- 
**************************************************** 
函数名:GetFolderSize 
作用:计算某个文件夹的大小 
参数:FileName----文件夹路径及文件夹名称 
返回值:数值 
**************************************************** 
PublicFunctionGetFolderSize(Folderpath) 
dimfso,d,size,showsize 
setfso=server.createobject(scripting.filesystemobject) 
drvpath=server.mappath(Folderpath) 
iffso.FolderExists(drvpath)Then 
setd=fso.getfolder(drvpath) 
size=d.size 
GetFolderSize=FormatSize(size) 
Else 
GetFolderSize=Folderpath&文件夹不存在 
EndIf 
EndFunction 
**************************************************** 
函数名:GetFileSize 
作用:计算某个文件的大小 
参数:FileName----文件路径及文件名 
返回值:数值 
**************************************************** 
PublicFunctionGetFileSize(FileName) 
Dimfso,drvpath,d,size,showsize 
setfso=server.createobject(scripting.filesystemobject) 
filepath=server.mappath(FileName) 
iffso.FileExists(filepath)then 
setd=fso.getfile(filepath) 
size=d.size 
GetFileSize=FormatSize(size) 
Else 
GetFileSize=FileName&文件不存在 
EndIf 
setfso=nothing 
EndFunction 
**************************************************** 
函数名:IsObjInstalled 
作用:检查组件是否安装 
参数:strClassString----组件名称 
返回值:false不存在,true存在 
**************************************************** 
PublicFunctionIsObjInstalled(strClassString) 
OnErrorResumeNext 
IsObjInstalled=False 
Err=0 
DimxTestObj 
SetxTestObj=Server.CreateObject(strClassString) 
If0=ErrThenIsObjInstalled=True 
SetxTestObj=Nothing 
Err=0 
EndFunction 
**************************************************** 
函数名:SendMail 
作用:用Jmail组件发送邮件 
参数:ServerAddress----服务器地址 
AddRecipient----收信人地址 
Subject----主题 
Body----信件内容 
Sender----发信人地址 
**************************************************** 
PublicfunctionSendMail(MailServerAddress,AddRecipient,Subject,Body,Sender,MailFrom) 
onerrorresumenext 
DimJMail 
SetJMail=Server.CreateObject(JMail.SMTPMail) 
iferrthen 
SendMail=没有安装JMail组件 
err.clear 
exitfunction 
endif 
JMail.Logging=True 
JMail.Charset=gb2312 
JMail.ContentType=text/html 
JMail.ServerAddress=MailServerAddress 
JMail.AddRecipient=AddRecipient 
JMail.Subject=Subject 
JMail.Body=MailBody 
JMail.Sender=Sender 
JMail.From=MailFrom 
JMail.Priority=1 
JMail.Execute 
SetJMail=nothing 
iferrthen 
SendMail=err.description 
err.clear 
else 
SendMail=OK 
endif 
endfunction 
**************************************************** 
函数名:ResponseCookies 
作用:写入COOKIES 
参数:Key----cookie名 
value----cookie值 
expires----cookie过期时间 
**************************************************** 
PublicFunctionResponseCookies(Key,Value,Expires) 
DomainPath=Left(Request.ServerVariables(script_name),inStrRev(Request.ServerVariables(script_name),/)) 
Response.Cookies(Key)=&Value& 
ifExpires<>0thenResponse.Cookies(Key).Expires=date+Expires 
Response.Cookies(Key).Path=DomainPath 
EndFunction 
**************************************************** 
函数名:CleanCookies 
作用:清除COOKIES 
**************************************************** 
PublicFunctionCleanCookies() 
DomainPath=Left(Request.ServerVariables(script_name),inStrRev(Request.ServerVariables(script_name),/)) 
ForEachobjCookieInRequest.Cookies 
Response.Cookies(objCookie)= 
Response.Cookies(objCookie).Path=DomainPath 
Next 
EndFunction 
**************************************************** 
函数名:GetTimeOver 
作用:清除COOKIES 
参数:flag---显示时间单位1=秒,否则毫秒 
**************************************************** 
PublicFunctionGetTimeOver(flag) 
DimEndTime 
Ifflag=1Then 
EndTime=FormatNumber(Timer()-StartTime,6,true) 
getTimeOver=本页执行时间:&EndTime&秒 
Else 
EndTime=FormatNumber((Timer()-StartTime)*1000,3,true) 
getTimeOver=本页执行时间:&EndTime&毫秒 
EndIf 
Endfunction 
-----------------系列格式化------------------------ 
**************************************************** 
函数名:FormatSize 
作用:大小格式化 
参数:size----要格式化的大小 
**************************************************** 
PublicFunctionFormatSize(dsize) 
ifdsize>=1073741824then 
FormatSize=Formatnumber(dsize/1073741824,2)&GB 
elseifdsize>=1048576then 
FormatSize=Formatnumber(dsize/1048576,2)&MB 
elseifdsize>=1024then 
FormatSize=Formatnumber(dsize/1024,2)&KB 
else 
FormatSize=dsize&Byte 
endif 
EndFunction 
**************************************************** 
函数名:FormatTime 
作用:时间格式化 
参数:DateTime----要格式化的时间 
Format----格式的形式 
**************************************************** 
PublicFunctionFormatTime(DateTime,Format) 
selectcaseFormat 
case1 
FormatTime=&year(DateTime)&年&month(DateTime)&月&day(DateTime)&日 
case2 
FormatTime=&month(DateTime)&月&day(DateTime)&日 
case3 
FormatTime=&year(DateTime)&/&month(DateTime)&/&day(DateTime)& 
case4 
FormatTime=&month(DateTime)&/&day(DateTime)& 
case5 
FormatTime=&month(DateTime)&月&day(DateTime)&日&FormatDateTime(DateTime,4)& 
case6 
temp=周日,周一,周二,周三,周四,周五,周六 
temp=split(temp,,) 
FormatTime=temp(Weekday(DateTime)-1) 
caseElse 
FormatTime=DateTime 
endselect 
EndFunction 
----------------------杂项--------------------- 
**************************************************** 
函数名:Zodiac 
作用:取得生消 
参数:birthday----生日 
**************************************************** 
publicFunctionZodiac(birthday) 
ifIsDate(birthday)then 
birthyear=year(birthday) 
ZodiacList=array(猴,鸡,狗,猪,鼠,牛,虎,兔,龙,蛇,马,羊) 
Zodiac=ZodiacList(birthyearmod12) 
endif 
EndFunction 
**************************************************** 
函数名:Constellation 
作用:取得星座 
参数:birthday----生日 
**************************************************** 
publicFunctionConstellation(birthday) 
ifIsDate(birthday)then 
ConstellationMon=month(birthday) 
ConstellationDay=day(birthday) 
ifLen(ConstellationMon)<2thenConstellationMon=0&ConstellationMon 
ifLen(ConstellationDay)<2thenConstellationDay=0&ConstellationDay 
MyConstellation=ConstellationMon&ConstellationDay 
ifMyConstellation<0120then 
constellation=<imgsrc=images/Constellation/g.giftitle=魔羯座Capricorn> 
elseifMyConstellation<0219then 
constellation=<imgsrc=images/Constellation/h.giftitle=水瓶座Aquarius> 
elseifMyConstellation<0321then 
constellation=<imgsrc=images/Constellation/i.giftitle=双鱼座Pisces> 
elseifMyConstellation<0420then 
constellation=<imgsrc=images/Constellation/^.giftitle=白羊座Aries> 
elseifMyConstellation<0521then 
constellation=<imgsrc=images/Constellation/_.giftitle=金牛座Taurus> 
elseifMyConstellation<0622then 
constellation=<imgsrc=images/Constellation/`.giftitle=双子座Gemini> 
elseifMyConstellation<0723then 
constellation=<imgsrc=images/Constellation/a.giftitle=巨蟹座Cancer> 
elseifMyConstellation<0823then 
constellation=<imgsrc=images/Constellation/b.giftitle=狮子座Leo> 
elseifMyConstellation<0923then 
constellation=<imgsrc=images/Constellation/c.giftitle=处女座Virgo> 
elseifMyConstellation<1024then 
constellation=<imgsrc=images/Constellation/d.giftitle=天秤座Libra> 
elseifMyConstellation<1122then 
constellation=<imgsrc=images/Constellation/e.giftitle=天蝎座Scorpio> 
elseifMyConstellation<1222then 
constellation=<imgsrc=images/Constellation/f.giftitle=射手座Sagittarius> 
elseifMyConstellation>1221then 
constellation=<imgsrc=images/Constellation/g.giftitle=魔羯座Capricorn> 
endif 
endif 
EndFunction 
================================================= 
函数名:autopage 
作用:长文章自动分页 
参数:id,content,urlact 
================================================= 
FunctionAutoPage(content,paramater,pagevar) 
contentStr=split(content,pagevar) 
pagesize=ubound(contentStr) 
ifpagesize>0then 
IfInt(Request(page))=orInt(Request(page))=0Then 
pageNum=1 
Else 
pageNum=Request(page) 
Endif 
ifpageNum-1<=pagesizethen 
AutoPage=AutoPage&contentStr(pageNum-1) 
AutoPage=AutoPage&<divstyle=margin-top:10px;text-align:right;padding-right:15px;><fontcolor=blue>页码:</font><fontcolor=red> 
Fori=0topagesize 
ifi=pageNum-1then 
AutoPage=AutoPage&[<fontcolor=red>&i+1&</font>] 
else 
ifinstr(paramater,?)>0then 
AutoPage=AutoPage&<ahref=¶mater&&page=&i+1&>[&(i+1)&]</a> 
else 
AutoPage=AutoPage&<ahref=¶mater&?page=&i+1&>[&(i+1)&]</a> 
endif 
endif 
Next 
AutoPage=AutoPage&</font></div> 
else 
AutoPage=AutoPage&非法操作!页号超出!<ahref=javascript:history.back(-1)><u>返回</u></a> 
endif 
Else 
AutoPage=content 
endif 
EndFunction 
EndClass 
%>