You are here: Re: Serving a website based on source internet address ? « PHP Programming Language « IT news, forums, messages
Re: Serving a website based on source internet address ?

Posted by Jerry Stuckle on 08/30/06 17:38

Skybuck wrote:
>><?php
>>
>> switch ($_SERVER['REMOTE_ADDR']) {
>> case '143.3.5.1':
>> header('Location: BlueIndex.htm');
>> break;
>> case '124.6.15.7':
>> header('Location: RedIndex.htm');
>> break;
>> default:
>> header('Location: DefaultIndex.htm');
>> }
>>?>
>
>
> Hello,
>
> Is it possible to use an "or" operator in php ? I only want to specific
> the location twice, since there are only two versions of the website.
> However there can be many ip's to include, for example in pseudo code:
>
> if (RemoteAddress = '192.5.6.7') or
> (RemoteAddress = '192.5.6.8') or
> (RemoteAddress = '192.4.6.8') or
> (RemoteAddress = '112.44.6.8') then
> begin
> header('Location: RedIndex.htm');
> end else
> begin
> header('Location: BlueIndex.htm');
> end;
>
> Is this possible in PHP ?
>
> Bye,
> Skybuck.
>

Did you try looking this up in the manual?

Yes, it is possible - see
http://www.php.net/manual/en/language.operators.logical.php.

But your problem is in how your if statement is constructed. See
http://www.php.net/manual/en/language.control-structures.php#control-structures.if


--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstucklex@attglobal.net
==================

 

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

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