查看: 959|回复: 11
|
请问如何使ASP网站限制某个国家的IP游览?
[复制链接]
|
|
似乎很容易实现,但是自己就一直不会,希望有高手指教!
另外,IP 的头两个数字就是只给一个国家使用而已?
例:马来西亚的是 219.95.*.* |
|
|
|
|
|
|
|
发表于 3-3-2006 01:02 AM
|
显示全部楼层
没什么用..只要用代理服务器..
我就可以看到你的网站了..如果你是要block 219.95.. |
|
|
|
|
|
|
|

楼主 |
发表于 3-3-2006 01:43 AM
|
显示全部楼层
我知道使用代理服务器就可以通过,但还是想要Block。
请问该如何呢? |
|
|
|
|
|
|
|

楼主 |
发表于 3-3-2006 01:44 AM
|
显示全部楼层
请问这个code 该如何改才能 Block 到 所有的 219.95.*.* 的 IP?
<%
'declare variables
Dim sIP
Dim sIParray(2)
'assign our blocked IP addresses to our array
sIParray(0) = "61.254.32.22"
sIParray(1) = "62.454.32.25"
sIParray(2) = "62.254.32.17"
'retrieve the visitors IP address
sIP = Request.ServerVariables("REMOTE_ADDR")
'loop through the banned IPs using the UBound function
For i = 0 to UBound(sIParray)
'check if IP address matches any of the blocked IPs
If sIP = sIParray(i) Then
Response.Redirect "no_access.asp"
End If
Next
%> |
|
|
|
|
|
|
|
发表于 3-3-2006 06:59 AM
|
显示全部楼层
原帖由 bpsim 于 3-3-2006 01:44 AM 发表
请问这个code 该如何改才能 Block 到 所有的 219.95.*.* 的 IP?
<%
'declare variables
Dim sIP
Dim sIParray(2)
'assign our blocked IP addresses to our array
sIParray(0) = "61.254.32. ...
并非Block 219.95.*.*就是Malaysia的, 你必须Download IP Table. 有Fomular算的. |
|
|
|
|
|
|
|
发表于 3-3-2006 11:48 AM
|
显示全部楼层
|
|
|
|
|
|
|

楼主 |
发表于 3-3-2006 12:52 PM
|
显示全部楼层
这个呢?自己下载到,然后改的,好像还是不能 block 到,我自己的 IP 还是可以进入。
<%
Dim shortIP, mySplit, LongIP
shortIP = Request.ServerVariables("REMOTE_HOST")
mySplit = Split(shortIP, ".")
LongIP = (mySplit(0)*(256*256*256)) + (mySplit(1)*(256*256)) + (mySplit(2)*256) + (mySplit(3))
'Create Array
Dim myArray(132,2)
Randomize
'Array Definition is (Country Name ,Begin Range, End Range)
myArray(0,0) = "MALAYSIA"
myArray(0,1) = "1023803392"
myArray(0,2) = "1023852543"
myArray(1,0) = "MALAYSIA"
myArray(1,1) = "2428960768"
myArray(1,2) = "2429026303"
myArray(2,0) = "MALAYSIA"
myArray(2,1) = "2710241280"
myArray(2,2) = "2710306815"
myArray(3,0) = "MALAYSIA"
myArray(3,1) = "2710437888"
myArray(3,2) = "2710503423"
myArray(4,0) = "MALAYSIA"
myArray(4,1) = "2854617088"
myArray(4,2) = "2854682623"
myArray(5,0) = "MALAYSIA"
myArray(5,1) = "3236200448"
myArray(5,2) = "3236233215"
myArray(6,0) = "MALAYSIA"
myArray(6,1) = "3262473996"
myArray(6,2) = "3262473996"
(省略其他120个……)
For i = LBound(myArray) to UBound(myArray)
If LongIP > myArray(i,2) And LongIP < myArray(i,1) Then
Response.Redirect("no_access.asp")
End If
Next
%> |
|
|
|
|
|
|
|

楼主 |
发表于 3-3-2006 12:54 PM
|
显示全部楼层
大家如果有个即时可以使用的 code ,希望可以给我,昨晚研究到5点还是没成,太没气了。 |
|
|
|
|
|
|
|
发表于 3-3-2006 08:51 PM
|
显示全部楼层
原帖由 belon_cfy 于 3-3-2006 06:59 AM 发表
并非Block 219.95.*.*就是Malaysia的, 你必须Download IP Table. 有Fomular算的.
什么是IP Table啊?那里有的download?有Fomular可以算出来自哪里的?请提供更多详情,谢谢! |
|
|
|
|
|
|
|

楼主 |
发表于 3-3-2006 09:45 PM
|
显示全部楼层
|
|
|
|
|
|
|
发表于 4-3-2006 06:28 PM
|
显示全部楼层
原帖由 bpsim 于 3-3-2006 01:43 AM 发表
我知道使用代理服务器就可以通过,但还是想要Block。
请问该如何呢?
Request.ServerVariables("HTTP_X_FORWARDED_FOR") |
|
|
|
|
|
|
|

楼主 |
发表于 4-3-2006 08:17 PM
|
显示全部楼层
原帖由 quantum^_^ 于 4-3-2006 06:28 PM 发表
Request.ServerVariables("HTTP_X_FORWARDED_FOR")
这个也不能保证所有的Proxy 可以阻止,还是有很大部分的Proxy 可以通过。 |
|
|
|
|
|
|
| |
本周最热论坛帖子
|