我的一亩三分地 我就喜欢!
13fen  设为主页
 收藏本站
 
当前位置: > 一亩三分地:首页 > 网络学院 > 网络编程 > ASP专区 > Asp组件/脚本 > 面向对象的asp编程之八---服务器端函数
热门文章排行
热门文章排行 手推车”功能的实现(10-07)
八大法则防范ASP网站漏洞(10-23)
ASP教程十一、调试ASP脚本(10-23)
在JSP中访问数据库大全(10-23)
虚机服务中常见Asp.Net低级错误一览(03-21)
精采文章排行
精采文章排行 ASP.NET实现抓取网页中的链接(11-15)
ASP连接数据库的11种方法(11-10)
如何动态创建网页的RSS内容摘要(11-10)
ASP网站漏洞及入侵防范方法(11-10)
ASP自定义函数:对字符串正则替换(11-10)
技术专题推荐
网管论坛交流
 

面向对象的asp编程之八---服务器端函数 

作者:佚名   来源:一亩三分地   点击:   日期:2007-03-28

<Script language="vbscript" runat="server">
'****************************************************************
' Script Compont Object Model
' Design for Active Server Pages
' Copyright 2004 Version 2.0
' Made by 尹曙光
' All Rights Reserved.
' ****************************************************************
'
' 系统常用的一些公用函数
'
'*****************************************************************

'系统公用信息显示
'strMsg:提示信息
'msgType:信息提示类型
'jumpUrl:页面眺转地址
'strCopyRight:版权信息
Function FShowMsg(strMsg,msgType,jumpUrl,strCopyRight)
Response.Write "<Style>"&chr(13)
Response.Write "BODY { margin: 0px 0px 0px 0px;FONT-FAMILY: '宋体','Tahoma', 'MS Shell Dlg';color: #000000;font: 9pt;background-color:#f0f1eb;}"&chr(13)
Response.Write "A{font:normal 12px 宋体;COLOR: #336699; TEXT-DECORATION: none}"&chr(13)
Response.Write "TD{font-family:宋体; font-size: 12px; line-height: 15px;background-color:#f0f1eb;}"&chr(13)
Response.Write ".THead{ background-color: #336699;color:#ffffff;font-weight:bold;}"&chr(13)
Response.Write ".TFoot{ background-color: #336699;COLOR: #ffffff;}"&chr(13)
Response.Write "</style>"&chr(13)

Response.Write "<table height='90%' width='100%'> <tr>"&chr(13)
Response.Write "<td align=center> <table align=center cellpadding=0 cellspacing=0 bordercolor='#336699' bgcolor='#336699' style='width:90%'>"
Response.Write "<tr align=center>"&chr(13)
Response.Write "<td width='100%' height=20 colspan=2 bgcolor='#336699' class='THead' >系统提示信息</t> "&chr(13)
Response.Write "<tr><td width='100%' colspan=2 align='center' bgcolor='#FFFFFF'><br> "&chr(13)
Response.Write strMsg
Select Case cint(msgType)
case 1
Response.Write "[<a href='javascript:window.close();'>关闭窗口</a>]"
Case 2
Response.Write "[<a href='javascript:history.back(-1);'>返回</a>]"
case 3
Response.Write "[<a href='javascript:history.back("&jumpUrl&");'>返回</a>]"
case 4
Response.Write "<meta HTTP-EQUIV=REFRESH CONTENT='3; URL="&jumpUrl&"'>,正在跳转..."
case 5
Response.Write "[<a href='"&jumpUrl&"'>返回</a>]"

End Select

Response.Write "<br><br></td></tr><tr align=center><td width='100%' height=20 colspan=2 class='TFoot'>"&chr(13)

Response.Write strCopyRight

Response.Write "</td> </tr></table></td> </tr> </table>"&chr(13)

Response.End()

End Function

'检查系统错误
'errMsg:出错后的提示信息
Function FIfError(errMsg)
if Err.number>0 then
Response.Write "<br>"
Response.Write errMsg
Response.End
end if
End Function

'显示系统错误信息
Function FSystemError()
if Err.number>0 then
Response.Write "<br>"
Response.Write "错误来源:"&Err.Source&"<br>"
Response.Write "错误代码:"&Err.number&"<br>"
Response.Write "错误说明:"&Err.Description &"<br>"
Response.End
end if
End Function

'判断是不是从form提交过来的
Function FIsPostBack()
if ( UCase(trim(Request.ServerVariables("REQUEST_METHOD")))="POST") then
FIsPostBack=true
else
FIsPostBack=false
end if
End Function


function FGetUserIp()
FGetUserIp=Request.ServerVariables("remote_addr")
End Function
</Script>





<Script language="vbscript" runat="server">
'****************************************************************
' Script Compont Object Model
' Design for Active Server Pages
' Copyright 2004 Version 2.0
' Made by 尹曙光
' All Rights Reserved.
' ****************************************************************
'
' 字符串处理函数
'
'*****************************************************************

'取得一个长度为ilen的字符串,含字母和数字
Function FRandomStr(ilen)
dim c,strResult
ilen=cint(ilen)
for i=1 to ilen
Randomize
c=Int((74 * Rnd) + 48) 'c>48 and c<122
while (c>57 and c<65) or (c>90 and c<97)
Randomize
c=Int((74 * Rnd) + 48)
wend
strResult=strResult&cstr(chr(c))
next
FRandomStr=strResult
End Function
'以下两个函数是用于检查身份证件号的
Function FCheckIdCard2(strIdCard)
dim iIdCard,strTmp
iIdCard=Len(strIdCard)
if (iIdCard=null or (not(iIdCard=15 or iIdCard=18))) then
FCheckIdCard2=false
exit function
end if

if iIdCard=15 then
strTmp=strIdCard
else
strTmp=mid(strIdCard,1,17)
end if

if IsNumeric(strTmp) then
FCheckIdCard2=true
else
FCheckIdCard2=false
exit function
end if

if iIdCard=18 then
strTmp=mid(strIdCard,18,1)
strTmp=ucase(strTmp)
if not (IsNumeric(strTmp) or strTmp="X") then
FCheckIdCard2=false
exit function
end if
end if
End Function

'检查身份证号
'参数:str:待检查的字符串
'参数2:出生日期的年(4位)
'参数3:出生日期的月
'参数4:出生日期的日
Function FCheckIdCard(byval strIdCard,byval iYear,byval iMonth,byval iDay)
dim strBirthDay,strTmp1

if not FCheckIdCard2(strIdCard) then
FCheckIdCard=false
exit function
end if

if len(iYear)<>4 then
FCheckIdCard=false
exit function
end if
strBirthDay=cstr(iYear)+String(2-len(cstr(iMonth)),"0")+cstr(iMonth)+String(2-len(cstr(iDay)),"0")+cstr(iDay)

if len(strIdCard)=15 then
strTmp1=mid(strIdCard,7,6)
strBirthDay=mid(strBirthDay,3,6)
if strTmp1<>strBirthDay then
FCheckIdCard=false
exit function
end if
else
strTmp1=mid(strIdCard,7,8)
if strTmp1<>strBirthDay then
FCheckIdCard=false
exit function
end if
end if
FCheckIdCard=true
End Function

'检查邮编
function FCheckPostCode(byval strCode)
if (len(trim(strCode))<>6) then
FCheckPostCode=false
exit function
else
FCheckPostCode=IsNumeric(strCode)
Exit Function
end if
End function
'-----------------可逆加密----------------------------------------------
function encrypt(byval ecode)
Dim texts
dim i
for i=1 to len(ecode)
texts=texts & chr(asc(mid(ecode,i,1))+i)
next
encrypt = texts
end function

fu

文章评论】 【收藏本文】 【推荐好友】 【打印本文】 【论坛讨论

   相关文章:
·ASP中巧用Response属性 ·第六课:ASP脚本循环语句
·在 Web 页上使用条件数值格式 ·连接数据库查询手册(不仅仅适用于asp)
·警惕"给你的FileSystemObject对象加把锁" ·用ASP做全文检索

   文章评论:(条)
  
 请留名: 匿名评论   点击查看所有评论 网管论坛
 

  责任编辑:一分  声明:刊登此文章是为了传递更多信息,文章内容仅供参考,转载请注明出处。