Okay so i have a page when it is visted stores there ip to file and bans there ip access to a differant page. Problem i have is it will only ban the last visted ip, which i want to ban all ip's in the file.
page1 which is visted and sotes ip in blocked_ips.php
<?
$ipaddress = "\r\n" . $_SERVER['REMOTE_ADDR'];
$file = 'blocked_ips.php';
$fp = fopen($file, 'a');
fwrite($fp, $ipaddress);
fclose($fp);
?>
page2 which denys access to the ip
<?php
$deny_ips = file('ban/blocked_ips.php');
// read user ip address:
$ip = isset($_SERVER['REMOTE_ADDR']) ? trim($_SERVER['REMOTE_ADDR']) : '';
// search current IP in $deny_ips array
if (($i = array_search($ip, $deny_ips)) !== FALSE){
// user is blocked:
print "<CENTER> YOU HAVE BEEN BANNED ! </CENTER>";
exit;
}
// If we reach this section, the IP address is valid
?>
<?php
so again the idea is to block/ban all ips in the blocked_ips.php, any help would be greatly appreciated.
thank you