常用ASP函数集【经验才是最重要的】(3)
Function IP2Num(sip)
'--------------------限制某段IP地址
dim str1,str2,str3,str4
dim num
IP2Num=0
if isnumeric(left(sip,2)) then
str1=left(sip,instr(sip,".")-1)
sip=mid(sip,instr(sip,".")+1)
str2=left(sip,instr(sip,".")-1)
sip=mid(sip,instr(sip,".")+1)
str3=left(sip,instr(sip,".")-1)
str4=mid(sip,instr(sip,".")+1)
num=cint(str1)*256*256*256+cint(str2)*256*256+cint(str3)*256+cint(str4)-1
IP2Num = num
end if
end function
'userIPnum = IP2Num(Request.ServerVariables("REMOTE_ADDR"))
'if userIPnum > IP2Num("192.168.0.0") and userIPnum < IP2Num("192.168.0.255") then
'response.write ("<center>您的IP被禁止</center>")
'response.end
'end if
Function chkFrom()
'----------------------------防站外提交设定
Dim server_v1,server_v2, server1, server2
chkFrom=False
server1=Cstr(Request.ServerVariables("HTTP_REFERER"))
server2=Cstr(Request.ServerVariables("SERVER_NAME"))
If Mid(server1,8,len(server2))=server2 Then chkFrom=True
End Function
'if not chkFrom then
'Response.write("请不要从站外提交内容!")
'Response.end
'End if
function getsys()
'----------------------------------操作系统检测
vibo_soft=Request.ServerVariables("HTTP_USER_AGENT")
if instr(vibo_soft,"Windows NT 5.0") then
msm="Win 2000"
elseif instr(vibo_soft,"Windows NT 5.1") then
msm="Win XP"
elseif instr(vibo_soft,"Windows NT 5.2") then
msm="Win 2003"
elseif instr(vibo_soft,"4.0") then
msm="Win NT"
elseif instr(vibo_soft,"NT") then
msm="Win NT"
elseif instr(vibo_soft,"Windows CE") then
msm="Windows CE"
elseif instr(vibo_soft,"Windows 9") then
msm="Win 9x"
elseif instr(vibo_soft,"9x") then
msm="Windows ME"
内容版权声明:除非注明,否则皆为本站原创文章。