 |
Results from the most recent live auction are here.
17 members in the live chat room. Join Chat!
| |
10-12-2007, 08:30 AM
|
· #1 | | Account Suspended Name: Sary Location: Baghdad Join Date: Oct 2007 | (PHP) Ban Ip From Your Site It is one of the effective code for banning the IP address from your website.
Just paste the codeinto your PHP page. PHP Code: <?php
// This will retrieve ip!
$ip = getenv('REMOTE_ADDR');
// Replace 'x' with ip address!
$blocked = "xx.xx.xx.xx";
if (ereg($blocked,$ip))
{
echo "You Have Been Banned";
exit();
}
?> 'echo "You Have Been Banned";'
this is the message which will be displayed when the banned ip goes on the page. Remember to swap the x's with the IP you wish to ban. |
| |
10-20-2007, 03:26 AM
|
· #2 | | NamePros Regular Location: At Home Join Date: Sep 2005
Posts: 806
NP$: 981.10 ( Donate)
| |
| |
11-20-2007, 09:41 AM
|
· #3 | | Senior Member Name: Soon.... Location: United Kingdom Join Date: Oct 2005
Posts: 1,550
NP$: 49.74 ( Donate)
| You may also want to use array() funtion in your code to use more then one ip address. |
| |
11-21-2007, 08:39 AM
|
· #4 | | Danltn.com Name: Daniel Neville Location: Danltn.com / Nottingham, UK Join Date: May 2007
Posts: 1,185
NP$: 681.56 ( Donate)
| PHP Code: $ips = array("1.2.3.4", "2.3.4.5");
if(in_array($_SERVER['REMOTE_ADDR'],$ips))
{
header("HTTP/1.0 403 Forbidden");
die("Your IP has been banned.");
}
Untested... |
| |
11-21-2007, 09:02 AM
|
· #5 | | NamePros Staff Name: Peter McDonald Location: Dundee, Scotland Join Date: Nov 2003
Posts: 3,914
NP$: 414.60 ( Donate)
| you should also check $_SERVER['X_FORWARDED_FOR'] in case they are using a proxy (although some proxies hide both) |
| |
11-30-2007, 11:21 AM
|
· #6 | | NamePros Member Location: UK Join Date: Sep 2005 | Enter the IP into 'hosts.deny'? |
| |
Posting Rules
| You may not post new threads You may not post replies You may not post attachments You may not edit your posts HTML code is Off | | | |