|
Ban IP from opening HTML page with PHP |
|
|
|
|
ban.php (replace €€€€€€ by the redirection URL, for example a void page an image or anything else) <?php $filename = "ban.txt"; $handle = fopen($filename, "r"); $string = fread($handle, filesize($filename)); fclose($handle); $sArr = explode("\n",$string); //get user IP address $userip = $_SERVER['REMOTE_ADDR']; //check for banned IP address if (in_array($userip, $sArr)) { echo "<script type=\"text/javascript\" language=\"javascript\">"; echo "window.open(\"€€€€€€\",\"_top\");"; echo "</script>"; } ?> *************** then add to your html page the following code between <body> and </body>: <iframe scrolling="no" name="ban_Invisible_frame" src="/ban.php" width="0" height="0" frameborder="0" border="0" ></iframe> ************* Then create a txt file 'ban.txt'. And put one IP per line.
|