[advanced search]
Results from the most recent live auction are here.
17 members in the live chat room. Join Chat!
Register Rules & FAQ NP$ Store Active Threads Mark Forums Read
Go Back   NamePros.Com > Design and Development > Programming > CODE
User Name
Password

Old 10-12-2007, 08:30 AM   · #1
Romance Of Love
Account Suspended
 
Name: Sary
Location: Baghdad
Trader Rating: (0)
Join Date: Oct 2007
Posts: 7
NP$: 0.00 (Donate)
Romance Of Love is an unknown quantity at this point
(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.


Please register or log-in into NamePros to hide ads
Romance Of Love is offline   Reply With Quote
Old 10-20-2007, 03:26 AM   · #2
asgsoft
NamePros Regular
 
asgsoft's Avatar
 
Location: At Home
Trader Rating: (36)
Join Date: Sep 2005
Posts: 806
NP$: 981.10 (Donate)
asgsoft is just really niceasgsoft is just really niceasgsoft is just really niceasgsoft is just really niceasgsoft is just really nice
nice tutorial

may I share http://www.thewebmasterstool.com/tu...g-on-your-site/ which is slightly more advanced as it uses MySQL but does the same job
asgsoft is offline   Reply With Quote
Old 11-20-2007, 09:41 AM   · #3
NetworkTown.Net
Senior Member
 
Name: Soon....
Location: United Kingdom
Trader Rating: (27)
Join Date: Oct 2005
Posts: 1,550
NP$: 49.74 (Donate)
NetworkTown.Net is just really niceNetworkTown.Net is just really niceNetworkTown.Net is just really niceNetworkTown.Net is just really nice
You may also want to use array() funtion in your code to use more then one ip address.
NetworkTown.Net is offline   Reply With Quote
Old 11-21-2007, 08:39 AM   · #4
Daniel
Danltn.com
 
Daniel's Avatar
 
Name: Daniel Neville
Location: Danltn.com / Nottingham, UK
Trader Rating: (65)
Join Date: May 2007
Posts: 1,185
NP$: 681.56 (Donate)
Daniel has a reputation beyond reputeDaniel has a reputation beyond reputeDaniel has a reputation beyond reputeDaniel has a reputation beyond reputeDaniel has a reputation beyond reputeDaniel has a reputation beyond reputeDaniel has a reputation beyond reputeDaniel has a reputation beyond reputeDaniel has a reputation beyond reputeDaniel has a reputation beyond reputeDaniel has a reputation beyond repute
Ethan Allen Fund Ethan Allen Fund
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...
Daniel is offline   Reply With Quote
Old 11-21-2007, 09:02 AM   · #5
Peter
NamePros Staff
 
Peter's Avatar
 
Name: Peter McDonald
Location: Dundee, Scotland
Trader Rating: (41)
Join Date: Nov 2003
Posts: 3,914
NP$: 414.60 (Donate)
Peter has much to be proud ofPeter has much to be proud ofPeter has much to be proud ofPeter has much to be proud ofPeter has much to be proud ofPeter has much to be proud ofPeter has much to be proud ofPeter has much to be proud ofPeter has much to be proud of
Child Abuse Save The Children Save The Children
you should also check $_SERVER['X_FORWARDED_FOR'] in case they are using a proxy (although some proxies hide both)
__________________
I Recommend HIVE DESIGNS for high quality web designs

Formerly peter@flexiwebhost
Peter is offline   Reply With Quote
Old 11-30-2007, 11:21 AM   · #6
aZooZa
NamePros Member
 
aZooZa's Avatar
 
Location: UK
Trader Rating: (3)
Join Date: Sep 2005
Posts: 27
NP$: 38.00 (Donate)
aZooZa is an unknown quantity at this point
Enter the IP into 'hosts.deny'?
__________________
Nominet Member and Registrar, UK
Complete UK dropcatching systems
aZooZa is offline   Reply With Quote
Closed Thread

NamePros is a revenue sharing forum.

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


Site Sponsors
Get Your Site Linked at LinkedKeywords.com Get Your Site Linked at LinkedKeywords.com http://www.mobisitetrader.com/
Advertise your business at NamePros
All times are GMT -7. The time now is 01:33 AM.


Powered by: vBulletin Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 2.4.0