Ban Script - Printable Version +- Support Forums (https://www.supportforums.net) +-- Forum: Categories (https://www.supportforums.net/forumdisplay.php?fid=87) +--- Forum: Coding Support Forums (https://www.supportforums.net/forumdisplay.php?fid=18) +---- Forum: PHP The Hypertext Preprocessor (https://www.supportforums.net/forumdisplay.php?fid=21) +---- Thread: Ban Script (/showthread.php?tid=720) |
Ban Script - brett7 - 10-08-2009 Here is a very effective IP Banning script. Add the ips, one ip per line in ip.txt, u can even use * as a wildcard. Just include the ban.php to all your web pages then you can add ips to the ips.txt file. The probelm is if you have a large ban file it can make your website slow. I did not make this. ip.txt Code: 66.249.73.* ban.php Code: <?php RE: Ban Script - Headshot - 10-08-2009 What appears when the banned person gets in the banned page? Can I customize that? RE: Ban Script - brett7 - 10-08-2009 at the moment it redirects to google.com "header("Location: http://google.com/");" but you could redirect to a custom ban.html or do " echo "Sorry you appear to be banned" " RE: Ban Script - Headshot - 10-08-2009 Great, thanks for this man. RE: Ban Script - brett7 - 10-08-2009 np RE: Ban Script - Project Evolution - 10-10-2009 Nice simple ban script. Good job. RE: Ban Script - Spl3en - 10-13-2009 You can improve it a bit by including $_SERVER['HTTP_X_FORWARD_FOR'] variable, if the user is trying to use a proxy which has been configured to allow this server variable So, PHP Code: if ($_SERVER['HTTP_X_FORWARD_FOR']) { Thanks for sharing, it will be useful RE: Ban Script - manipulate - 10-20-2009 (10-08-2009, 01:58 PM)brett7 Wrote: at the moment it redirects to google.com That would just add it to the start of the page, you'd have to die(); it to stop the actual page from loading. RE: Ban Script - ethical_john - 10-21-2009 I need help in this piece of code. First of all,I prepare myself an index.php Quote:<html> Secondly,I prepared the ip.txt.I am running this script on Apache server running locally.Both of the IPs are pointing toward my machine. Quote:127.0.0.1 Finally,I paste in this code bans.php,but I coundn't get this to work. I still can access the site. The message "Welcome people" still showing on my screen. I am very new to PHP. Anyone can guide me? Thanks. RE: Ban Script - Gaijin - 10-21-2009 ^^ It works well for me, post your PHP code you did something wrong. |