Forum Moderators: coopster
___________________________________________________________
***************
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.
___________________________________________________________
Quite useful to ban some annoying visitors. ;-)
even if you do not have mod_geoip support then do it with htaccess rather putting frames in your pages.
and btw it should not be JAVA but JAVASCRIPT in your post's title
[edited by: phparion at 11:46 am (utc) on June 27, 2007]
So low-cost that I don't have any control over the server side (no right to change CHMOD 644, no htaccess available, no URL rewritting..., well just the minimum + PHP). :-(
That's the only way I could find to put a banning system considering the limitations of my host.
Do you have other methods for a limited server-side control and without htaccess?
phparion --> Javascript indeed ;-p