|
Posted by Janwillem Borleffs on 09/28/77 11:49
carmen wrote:
> Is there an easy way to tweak the file so that
> 1. If there is a match of the surfers IP address to one in the list
> (1.list), rather then get a banned message, the rest of the php
> script runs. 2. If the surfers IP address does not match any of the IP
> address in
> the list (1.list), then instead of echo 'banned'; the surfer is
> redirected to another webpage.
>
$IP = $_SERVER['REMOTE_ADDR'];
$IP_array = file('../info/1.list');
$IP_array = str_replace(array("\n", "\r"), "", $IP_array);
if (!in_array($IP, $IP_array)) {
header("Location: banned.php");
exit;
}
JW
Navigation:
[Reply to this message]
|