通过本文主要向大家介绍了asp 日期函数,asp 时间函数,asp函数,asp函数大全,asp 调用函数等相关知识,希望对您有所帮助,也希望大家支持linkedu.com www.linkedu.com
<%
'*******************************************************************
'取得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
'*******************************************************************
'转换IP地址
'*******************************************************************
Function cip(sip)
tip = CStr(sip)
sip1 = Left(tip, CInt(InStr(tip, ".") -1))
tip = Mid(tip, CInt(InStr(tip, ".") + 1))
sip2 = Left(tip, CInt(InStr(tip, ".") -1))
tip = Mid(tip, CInt(InStr(tip, ".") + 1))
sip3 = Left(tip, CInt(InStr(tip, ".") -1))
sip4 = Mid(tip, CInt(InStr(tip, ".") + 1))
cip = CInt(sip1) * 256 * 256 * 256 + CInt(sip2) * 256 * 256 + CInt(sip3) * 256 + CInt(sip4)
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
'*******************************************************************
' 我比较喜欢将以上三个结合起来使用
'*******************************************************************
Function Alert(message, gourl)
message = Replace(message, "'", "\'")
If gourl = "-1" Then
Response.Write ("<script language=javascript>alert('" & message & "');history.go(-1)</script>")
Else
Response.Write ("<script language=javascript>alert('" & message & "');location='" & gourl &"'</script>")
End If
Response.End()
End Function
'*******************************************************************
' 指定秒数重定向另外的连接
'*******************************************************************
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
Else
getextend = ""
End If
End Function
' *----------------------------------------------------------------------------
' * 函数:CheckIn
' * 描述:检测参数是否有SQL危险字符
' * 参数:str要检测的数据
' * 返回:FALSE:安全 TRUE:不安全
' * 作者:
' *&nbs
'*******************************************************************
'取得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
'*******************************************************************
'转换IP地址
'*******************************************************************
Function cip(sip)
tip = CStr(sip)
sip1 = Left(tip, CInt(InStr(tip, ".") -1))
tip = Mid(tip, CInt(InStr(tip, ".") + 1))
sip2 = Left(tip, CInt(InStr(tip, ".") -1))
tip = Mid(tip, CInt(InStr(tip, ".") + 1))
sip3 = Left(tip, CInt(InStr(tip, ".") -1))
sip4 = Mid(tip, CInt(InStr(tip, ".") + 1))
cip = CInt(sip1) * 256 * 256 * 256 + CInt(sip2) * 256 * 256 + CInt(sip3) * 256 + CInt(sip4)
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
'*******************************************************************
' 我比较喜欢将以上三个结合起来使用
'*******************************************************************
Function Alert(message, gourl)
message = Replace(message, "'", "\'")
If gourl = "-1" Then
Response.Write ("<script language=javascript>alert('" & message & "');history.go(-1)</script>")
Else
Response.Write ("<script language=javascript>alert('" & message & "');location='" & gourl &"'</script>")
End If
Response.End()
End Function
'*******************************************************************
' 指定秒数重定向另外的连接
'*******************************************************************
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
Else
getextend = ""
End If
End Function
' *----------------------------------------------------------------------------
' * 函数:CheckIn
' * 描述:检测参数是否有SQL危险字符
' * 参数:str要检测的数据
' * 返回:FALSE:安全 TRUE:不安全
' * 作者:
' *&nbs