Re: set multiple variables
| From: | Brad Pauly | Date: | Fri, 01 Oct 2004 21:54:09 +0000 |
| Subject: | Re: set multiple variables | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-198464@lists.php.net to get a copy of this message | ||
On Fri, 1 Oct 2004 17:38:31 -0400, Joe Szilagyi <js@axxs.net> wrote:
> Hi, I have this working:
>
> if ($REMOTE_ADDR == "212.3.54.65") {
> header("Location:
> http://www.google.com/search?&q=huzzah");
> Redirect browser
> exit;
> }
>
> But I want to specify multiple IPs. What's the best recommended way for
> doing that?
One way would be to create an array of ips and look for it in that array:
$ips = array('127.0.0.1','192.168.1.50');
if (in_array($REMOTE_ADDR, $ips)) {
// do stuff
}
- Brad