You are here: Re: Tweaking a script « All PHP « IT news, forums, messages
Re: Tweaking a script

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]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация