This is a very old tiny script that I've used to ban ip addresses from the php page/website. Bans are not a good solution in terms of performances of the website, expecially if the bans list is long or complex to elaborate. function checkbans(){ $handle = fopen("ipbans.dat.php", "r"); if($handle === false){ return false; } while (!feof($handle)) { $line = trim(fgets($handle, 32)); if( $line == $_SERVER['REMOTE_ADDR'] ) { fclose($handle); //header('Location: http://www.google.com'); //redirect to google? exit(); } } fclose($handle); } You can just call the ch...