Author |
Topic  |
|
PeeWee.Inc
Senior Member
   
United Kingdom
1893 Posts |
Posted - 13 January 2003 : 09:55:50
|
Anyone know a HTML script i could use to redirect 4 or 5 IP's away from my site and say to yahoo.com or sumthing? |
De Priofundus Calmo Ad Te Damine |
|
Nikkol
Forum Moderator
    
USA
6907 Posts |
Posted - 13 January 2003 : 10:15:16
|
Put this at the top of the page and give the page an asp extension.
<%
set userIP = Request.ServerVariable("REMOTE_ADDR")
Select Case userIP
Case "xxx.xxx.xxx.xxx", "yyy.yyy.yyy.yyy", "zzz.zzz.zzz.zzz"
response.redirect("http://www.yahoo.com")
End Select
%>
|
Nikkol ~ Help Us Help You | ReadMe | 3.4.03 fixes | security fixes ~ |
 |
|
PeeWee.Inc
Senior Member
   
United Kingdom
1893 Posts |
Posted - 13 January 2003 : 10:32:48
|
Thank you, i am not sure if my friend can use ASP, she is goin to tell me 2moro but, i will give her this 
Thank you  |
De Priofundus Calmo Ad Te Damine |
 |
|
dayve
Forum Moderator
    
USA
5820 Posts |
Posted - 13 January 2003 : 11:25:07
|
if she cannot use ASP have her try this:
<script language="javascript">
var ip = '<!--#echo var="REMOTE_ADDR"-->'
if (ip == '206.186.23.178') {
alert("STOP! You are viewing this page from an IP address that is not allowed!");
alert("Why can't you guys just leave me alone?");
if (confirm("Do you want to leave peacefully? Or will I have to help you?"))
{location.href="http://www.yahoo.com" } else { ("OK you choose I don't care! Bye bye! Don't come back!"); {location.href="http://www.yahoo.com" }} }
</script>
the tricky part is seeing if her host will allow echo's (see red portion above) |
|
 |
|
Roland
Advanced Member
    
Netherlands
9335 Posts |
Posted - 13 January 2003 : 11:47:10
|
I use this on my site:
strIPAddress = Request.ServerVariables("REMOTE_ADDR")
strBannedIP = "212.25.114.222|62.219.119.159|80.195.52.37"
if instr(strBannedIP, strIPAddress)> 0 then
Response.Redirect "noaccess.asp"
end if |
 |
|
wii
Free ASP Hosts Moderator
    
Denmark
2632 Posts |
Posted - 13 January 2003 : 13:25:42
|
FrutZle, your code works fine, but how do I write a range? for example:
212.25.114.0 - 212.25.114.255
|
 |
|
dayve
Forum Moderator
    
USA
5820 Posts |
Posted - 13 January 2003 : 13:41:28
|
Using Frutzle's code you can just eliminate the last subnet, so the code would look like this:
strIPAddress = Request.ServerVariables("REMOTE_ADDR")
strBannedIP = "212.25.114.|80.195.52."
if instr(strBannedIP, strIPAddress)> 0 then
Response.Redirect "noaccess.asp"
end if
The above code would ban anyone with ip ranges: 212.25.114.0 - 212.25.114.255 80.195.52.0 - 80.195.52.255 |
|
Edited by - dayve on 13 January 2003 13:47:57 |
 |
|
dayve
Forum Moderator
    
USA
5820 Posts |
Posted - 13 January 2003 : 13:46:05
|
ack, wait that won't work.... brb...  |
|
 |
|
Roland
Advanced Member
    
Netherlands
9335 Posts |
Posted - 13 January 2003 : 13:48:21
|
by the way, those IP addresses are actually banned from my site for trying to get to files they don't have access to (like the Snitz database, even though the only way to get to that is through FTP). I was too lazy to make up fake IP addresses  |
 |
|
dayve
Forum Moderator
    
USA
5820 Posts |
Posted - 13 January 2003 : 13:52:12
|
this is kind of hokey but...
strIPAddress = Request.ServerVariables("REMOTE_ADDR")
strBannedIP = "212.25.114.|62.219.119.159"
for ipSub = 0 to 255
if (instr(strBannedIP & ipSub, strIPAddress) OR instr(strBannedIP, strIPAddress)) > 0 then
Response.Redirect "noaccess.asp"
end if
next
|
|
Edited by - dayve on 13 January 2003 13:54:27 |
 |
|
|
Topic  |
|