Reply to Re: Serving a website based on source internet address ?

Your name:

Reply:


Posted by Jerry Stuckle on 08/29/06 18:21

Skybuck wrote:
> Hello,
>
> Based on the source internet address a different version of the website
> should be presented/served to the user/browser.
>
> I would like to keep the script as simple as possible and it should
> replace the index.php.
>
> The script could look something like this in pseudo code:
>
> if SourceAddress = '143.3.5.1' then
> begin
> ShowBlueWebsite; // load/show BlueIndex.htm
> end else
> if SourceAddress = '124.5.15.7' then
> begin
> ShowRedWebsite; // load/show RedIndex.htm
> end;
>
> Is this possible with php ?
>
> Bye,
> Skybuck.
>

Sure.

<?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');
}
?>

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

[Back to original 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

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