日期:2010-04-27  浏览次数:20966 次

'*******************************************************************
'取得IP地址
'*******************************************************************
Function Userip()
    Dim GetClientIP
    '如果客户端用了代理服务器,则应该用ServerVariables("HTTP_X_FORWARDED_FOR")方法
    GetClientIP = Request.ServerVariables("HTTP_X_FORWARDED_FOR")
    If GetClientIP = "" or isnull(GetClientIP) or isempty(GetClientIP) Then
        '如果客户端没用代理,应该用Request.ServerVariables("REMOTE_ADDR")方法
        GetClientIP = Request.ServerVariables("REMOTE_ADDR")
    end if
    Userip = GetClientIP
End function

'*******************************************************************
弹出对话框
'*******************************************************************
Sub alert(message)
  message = replace(message,"'","\'")
  Response.Write ("<script>alert('" & message & "')</script>")
End Sub
 
'*******************************************************************
返回上一页,一般用在判断信息提交是否完全之后
'*******************************************************************
Sub GoBack()
  Response.write ("<script>history.go(-1)</script>")
End Sub
 
'*******************************************************************
重定向另外的连接
'*******************************************************************
Sub Go(url)
  Response.write ("<script>location.href('" & url & "')</script>")
End Sub

'*******************************************************************
指定秒数重定向另外的连接
'*******************************************************************
sub GoPage(url,s)
  s=s*1000
  Response.Write "<SCRIPT LANGUAGE=JavaScript>"
  Response.Write "window.setTimeout("&chr(34)&"window.navigate('"&url&"')"&chr(34)&","&s&")"
  Response.Write "</script>"
end sub

'*******************************************************************
判断数字是否整形
'*******************************************************************
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)<"0" then
isInteger=false 
exit function
end if
next
isInteger=true
if err.number<>0 then err.clear
end function

'*******************************************************************
获得文件扩展名
'*******************************************************************
function GetExtend(filename)
dim tmp
if filename<>"" then
tmp=mid(filename,instrrev(filename,".")+1,len(filename)-instrrev(filename,"."))
tmp=LCase(tmp)
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
getextend="txt"
else
getextend=tmp
end if
els