Go Back   Gaming Gutter > Non-Gaming > Programming > Tutorials


Tutorials - Looking for programming tutorials to increase your knowledge? Do so here.

» Site Navigation
» Home
» FAQ
» Log in
User Name:

Password:

Not a member yet?
Register Now!
» Advertisement
» Recent Threads
Go to first new post WTF @ RAPING LITTLE SUZY.
Yesterday 08:40 PM
Last post by Benita Mussolina
Today 10:22 PM
25 Replies, 26 Views
Go to first new post [B] FQD!
Today 09:09 PM
Last post by ragefury
Today 10:21 PM
1 Replies, 2 Views
Go to first new post selling 23 monther
Today 06:02 PM
Last post by Arthritis
Today 10:19 PM
4 Replies, 5 Views
Go to first new post tnt detects you ss
08-27-2008 04:56 PM
Last post by ragefury
Today 10:18 PM
53 Replies, 54 Views
Go to first new post Lots of Legit Items
08-31-2008 02:34 PM
Last post by Yeash
Today 10:09 PM
10 Replies, 11 Views
Reply
 
LinkBack Thread Tools Display Modes

 Banning an IP Using PHP
Old 10-18-2006, 03:44 PM   #1 (permalink)
Oosband
Guest
 
Posts: n/a
iTrader: / %
Banning an IP Using PHP

You first need to get the IP of the person you wish to ban.
Most popular PHP Scripts such as ShoutBoxes, Pluggers, and Polls, all log users IP's.

Now copy and paste the following code into any page you
wish that Internet Protocol (IP) Not to view.
Code:
<?php
if (ereg("IP",$REMOTE_ADDR))
{
echo "You are banned go away."; exit(); }
?>
Things To Change:
Change IP to whatever IP you wish to ban.
You are banned go away. Can be changed to whatever message
you wish to display when that user views the pages in which you inserted this code.
  Reply With Quote

 
Old 10-18-2006, 03:45 PM   #2 (permalink)
Oosband
Guest
 
Posts: n/a
iTrader: / %
This was the follow up tutorial...slighty more plump but pretty much the same.

---

Someone causing you pain? BAN THEM!

Code:
<?php
$ip=getenv('REMOTE_ADDR');
$banned=xxx.xxx.xxx.xxx;
if (ereg($banned,$ip)) {
echo 'Sorry...but you've been BANNED!';
exit();
}
?>
-- That's the full code...but what's the use of it without an explination?

<?php
This opens the php script.

$ip=getenv('REMOTE_ADDR');
This gets the visitor's IP address.

$banned=xxx.xxx.xxx.xxx;
Replace "xxx.xxx.xxx.xxx" with the IP of the banned user.

if (ereg($banned,$ip)) {
This see's if the visitor's IP and the Banned IP match.

If they do match the visitor will recieve a message:
echo 'Sorry...but you've been BANNED!';
And the page wont load. (Feel free to change the message).

exit();
}
?>

Just closing the script.

---

No more trouble!
  Reply With Quote
Reply

Bookmarks



Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

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

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Similar Threads
Thread Thread Starter Forum Replies Last Post
Banning MasterDevil MapleStory 8 10-29-2006 02:58 PM

Powered by vBadvanced CMPS v3.0 RC2

All times are GMT -7. The time now is 10:24 PM.


vBulletin skin developed by: eXtremepixels
The contents of this webpage are copyright © 2006-2008 GamingGutter.com. All Rights Reserved.

Page generated in 0.10109997 seconds (100.00% PHP - 0% MySQL) with 20 queries