|
Posted by carmen on 09/28/98 11:49
I came across this free script on the net that compares the IP address of a
surfer to a list (1.list). If there is a match, the surfer gets the message
banned. If there is no match, the rest of the php script runs.
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.
Thank you
<?php
$IP = $_SERVER['REMOTE_ADDR'];
$IP_array = file('../info/1.list');
$IP_array = str_replace("\n", "", $IP_array);
$IP_array = str_replace("\r", "", $IP_array);
foreach ($IP_array as $IP_test) {
if (substr_count($IP, $IP_test) != "0") {
echo 'banned';
die();
}
}
************* REST OF THE SCRIPT *************
Navigation:
[Reply to this message]
|