----- Original Message -----
From: "Labunski" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Wednesday, March 17, 2004 5:46 PM
Subject: [PHP] Small Problem - could you help me, please?
> $ip = getenv ("REMOTE_ADDR");
>
> function kick() {
> $file_ip = file("log.txt");
> foreach($file_ip as $value_ip ) {
> $kick .= "$value_ip";
> }
> return $kick;
> }
> if ($ip == kick()){
> echo "Sorry, the access is denied.";
>
> exit;
> }
I'm assuming your log.txt is in format of
xxx.xxx.xxx.xxx
xxx.xxx.xxx.xxx
xxx.xxx.xxx.xxx
etc, which will create the array in $file_ip. try changing to this:
function kick($ip)
{
$file_ip = file('log.txt');
$access = 'yes';
foreach($file_ip as $value_ip)
{
if ($ip == $file_ip)
{
$access = 'no';
}
}
}
if (kick($ip) == 'yes')
{
your_allowed_in;
}
else
{
your not allowed;
}
that help?
Jake
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php