Hi,
Im trying to add some code to ban certain ips from certain categories and pages in my site
the code is
<?php
$filelocation = "banned.txt";
$banned_message = "site is now closed";
$banned_url = "http://www.testbanned.com"; # url for redirect here
function ShowBan() {global $banned_url, $banned_message; if ($banned_url == "") exit($banned_message); else header("Location: $banned_url"); exit;}
if ($_SESSION_['banned'] == 'TRUE') ShowBan();
if (!isset($_SESSION)) session_start();
$ip = isset($_SERVER['HTTP_X_FORWARDED_FOR']) ? $_SERVER['HTTP_X_FORWARDED_FOR'] : $_SERVER['REMOTE_ADDR'];
$banfile = file($filelocation);
foreach ($banfile as $list)
{
$list = rtrim($list); # trim the eol trash
if (strstr($ip, $list) && strpos($ip, $list)==0)
{
$_SESSION_['banned'] == 'TRUE';
ShowBan();
}
}
?>
so what i have tried is add a folder of the page name to /includes/modules/pages/
so as an example /includes/modules/pages/special-items
and copy in a modifed header_php.php
i am using ceon url so special-items is the page name given, i have also tried cPath=18, cPath18, cPath_18
none of it works!
as a test i did modify the file /includes/modules/pages/about_us that is in there already and it works perfectly, so maybe i am on the right track?
or is there an easier way to accomplish this in another header file?


Reply With Quote
