Snitz Forums 2000
Snitz Forums 2000
Home | Profile | Register | Active Topics | Members | Search | FAQ
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 Community Forums
 Community Discussions (All other subjects)
 Send Users Away
 New Topic  Topic Locked
 Printer Friendly
Author Previous Topic Topic Next Topic  

PeeWee.Inc
Senior Member

United Kingdom
1893 Posts

Posted - 13 January 2003 :  09:55:50  Show Profile  Visit PeeWee.Inc's Homepage
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  Show Profile
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 ~
Go to Top of Page

PeeWee.Inc
Senior Member

United Kingdom
1893 Posts

Posted - 13 January 2003 :  10:32:48  Show Profile  Visit PeeWee.Inc's Homepage
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
Go to Top of Page

dayve
Forum Moderator

USA
5820 Posts

Posted - 13 January 2003 :  11:25:07  Show Profile  Visit dayve's Homepage
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)

Go to Top of Page

Roland
Advanced Member

Netherlands
9335 Posts

Posted - 13 January 2003 :  11:47:10  Show Profile
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
Go to Top of Page

wii
Free ASP Hosts Moderator

Denmark
2632 Posts

Posted - 13 January 2003 :  13:25:42  Show Profile
FrutZle, your code works fine, but how do I write a range? for example:

212.25.114.0 - 212.25.114.255

Go to Top of Page

dayve
Forum Moderator

USA
5820 Posts

Posted - 13 January 2003 :  13:41:28  Show Profile  Visit dayve's Homepage
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
Go to Top of Page

dayve
Forum Moderator

USA
5820 Posts

Posted - 13 January 2003 :  13:46:05  Show Profile  Visit dayve's Homepage
ack, wait that won't work.... brb...

Go to Top of Page

Roland
Advanced Member

Netherlands
9335 Posts

Posted - 13 January 2003 :  13:48:21  Show Profile
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
Go to Top of Page

dayve
Forum Moderator

USA
5820 Posts

Posted - 13 January 2003 :  13:52:12  Show Profile  Visit dayve's Homepage
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
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Topic Locked
 Printer Friendly
Jump To:
Snitz Forums 2000 © 2000-2021 Snitz™ Communications Go To Top Of Page
This page was generated in 0.36 seconds. Powered By: Snitz Forums 2000 Version 3.4.07