[RELEASE] IP Block in PHP

11/09/2010 22:56 shaiyarebirth#1
Hi there everyone.

Well regarding this topic that Danco1990 posted: [Only registered and activated users can see links. Click Here To Register...]

I thought that would be a good idea show, who needs, how to ip block persons from your website.

Its a real simple code but you can increment it, the best thing to do to increment, would be creating a new table to your SQL and put them in there with an Administrative tool, and bring back the array from the DB, but if you don't have this expertise, you can simple add new IP's to the array created on the $ipDeny var:

PHP Code:
<?php
$ipDeny 
= array("111.111.111""222.222.222""333.333.333");
if (
in_array ($_SERVER['REMOTE_ADDR'], $ipDeny)) {
   
header("location: http://www.iamastupidretard.com/");
   exit();
?>
Since this makes a Header Location in PHP, add this to the very beginning of your code, right before anything, any <html> tag and all.

Any problem you guys have, or any script in php you need.. feel free to answer this topic and i see what i can do.

Regards,
11/10/2010 15:26 Alladrios#2
PHP Code:
header("location: http://www.iamastupidretard.com/"); 
The website exists lol. All IP banned players may enjoy it and actually learn something.