0

Hi, I am having trouble with this chunk of PHP script:

   <?php
$deny = array("Example IP");
if (in_array ($_SERVER['REMOTE_ADDR'], $deny)) {
   header("location: http://www.google.com/");
   exit();
} ?>

It works fine, its just when I try to link to a file that has the $deny var, it wont work. I tried using fopen(); and include();..... I just want it so that I don't have to go to every page of my website just to update a ip address. All I'm saying is that I don't want to have to update every single page of my website, I just want the $deny var in a different script, so that all the pages pull the data of the $deny var from a different file, not each individual page that has the lines of code. If you want to se what made me fail here are samples:

one example:

<?php
$arry = fopen("banned/bannames.php");
if (in_array ($_SERVER['REMOTE_ADDR'], $arry )) {
   header("location: http://www.myurl.com/banned/banned.php");
   exit();
   close_fopen();
}
?>

The bannednames.php file contains this:

<?php
//The $deny var.... This is the var used in all pages, but the IP's are in here
//Not repeated in all pages.
$deny = array("example IP");

?>

I just want it so that I dont have to update all the pages for a single IP, I want it so that I only need to put the IP in the bannames.php instead of every single page. I would be happy if someone helped me out here.

Thanks...

1
Contributor
1
Reply
3
Views
5 Years
Discussion Span
Last Post by Djmann1013
This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.