FRIHOST FORUMS SEARCH FAQ TOS BLOGS COMPETITIONS
You are invited to Log in or Register a free Frihost Account!


Ban Users Ip: 72.265.31.23





NG
Step 1
To use the below code, simply past one of the codes in a file named ban.php

Then at the top of each html page or one of your header files put:

require('ban.php')

This script will ban the person(s) from viewing the site.

Step 2
Code:
<?php
// For a single user ban
$ban_ip = 'xxx.xxx.xxx.xxx'; // ip address of the person you want to ban

// DO NOT EDIT BELOW HERE UNLESS YOU KNOW WHAT YOU ARE DOING
$visitor_ip = $_SERVER['REMOTE_ADDR']; // the ip address of the visitor
if($visitor_ip == $ban_ip)
{
die("You are banned from this site!");
}

// For a multiple user ban
$ban_ip = "xxx.xxx.xxx.1,xxx.xxx.xxx.2"); // put ip addresses, separated by commas
// DO NOT EDIT BELOW HERE UNLESS YOU KNOW WHAT YOU ARE DOING
$visitor_ip = $_SERVER['REMOTE_ADDR'];
$ip_list = explode(",", $ban_ip);
foreach($ip_list as $ip)
{
if($visitor_ip == $ip)
{
die("You are banned from this site!");
}
}

?>
devroom
dude to earn points u dont just copy a script

LOSER

http://www.zymic.com/view_tutorial.php?id=93
DanielXP
Shocked a ripped tutorial shame on u Shocked
krazycapital
I knew I recognized that from somewhere. DON'T DO THIS! If I'm not mistaken, it's against the law.
Antoine_935
I modified it, so that you can put multiple ip's. The example shown is stupid !
Code:
<?php
$ban_ip = array(); // ip address of the persons you want to ban
$visitor_ip = ; // the ip address of the visitor
if(in_array($_SERVER['REMOTE_ADDR'], $ban_ip))
{
die("");
}
?>

It will work much faster than the fisrt example.
Nyizsa
I think the most effective ban can be done via .htaccess. And you may set up a custom Error 403 page to tell the user that he is banned.
NG
how is tht a rip u froobs its made by me and lots of other ppl hav an ip ban script u n00bs
Related topics
users online, using php and text file
IP Address HTML CODE
Are you blocking ip address of banned users?
A preview account to my site:
A preview account to my site:
Login, database and ban
Potential phpBB Hack Coming?
How to ban someone's IP from accesing my site?
IP Address Banning ( Not using .htaccess)
How Internet Works!
Some not so commonly asked questions.
BOT prevention - stand out from the crowd
Suspended Again?
Ban An Ip From Your Website
Reply to topic    Frihost Forum Index -> Scripting -> Php and MySQL

FRIHOST HOME | FAQ | TOS | ABOUT US | CONTACT US | SITE MAP
© 2005-2011 Frihost, forums powered by phpBB.