Filtering limit function for ip in Asp
<%
'Get the visitor's address
ip=Request.ServerVariables("REMOTE_ADDR")
'The allowed IP address segments are 10.0.0.0~10.68.63.255
allowip1="10.0.0.0"
allowip2="10.68.10.71"
response.writecheckip(ip, allowip1, allowip2)
functioncheckip(ip, allowip1, allowip2)
dimcheck(4)
checkip=false
ipstr=split(ip,".")
allow1=split(allowip1,".")
allow2=split(allowip2,".")
ifcint(allow1(0))>cint(allow2(0))then
'Just determine whether the IP address segment is legal
response.write "There is an error in IP address segment!"
exitfunction
endif
fori=0toubund(ipstr)
ifcint(allow1(i))<cint(allow2(i))then
ifcint(allow1(i))=cint(ipstr(i))then
check(i)=true
checkip=true
exitfor
elseifcint(ipstr(i))<cint(allow2(i))then
check(i)=true
checkip=true
exitfor
elseifcint(ipstr(i))>cint(allow2(i))then
check(i)=false
checkip=false
exitfor
else
check(i)=true
checkip=true
endif
endif
endif
elseifcint(allow1(i))>cint(ipstr(i))orcint(allow1(i))<cint(ipstr(i))then
check(i)=false
checkip=false
ifi<>ubund(ipstr)then
exitfor
endif
else
check(i)=true
endif
endif
next
if(check(0)=trueandcheck(1)=trueandcheck(2)=trueandcheck(3)=false)and(cint(allow2(2))>cint(ipstr(2)))then
checkip=true
endif
endfunction
%>
<%
'Enum all values submitted using HTML form
ForEachitemInRequest.Form
Response.WriteRequest.Form(item)
Next
%>
List all values submitted using HTML forms
Use ASP to get image size
<%
imgpath="default_22.gif"
setpp=newimgInfo
w=pp.imgW(server.mappath(imgpath))
h=pp.imgH(server.mappath(imgpath))
setpp=nothing
response.write"<imgsrc='"&imgpath&"'border=0><br>Width:"&w&";High:"&h
ClassimgInfo
dimaso
PrivateSubClass_Initialize
setaso=CreateObject("Adodb.Stream")
aso.Mode=3
aso.Type=1
aso.Open
EndSub
PrivateSubClass_Terminate
err.clear
setaso=nothing
EndSub
PrivateFunctionBin2Str(Bin)
DimI,Str