You are here: Re: [PHP] 1 ip address go here all others go here « PHP « IT news, forums, messages
Re: [PHP] 1 ip address go here all others go here

Posted by Dave Carrera on 10/03/08 11:34

Thanks David,

Thats the kind of thing i was looking for.

Onwards and upwards ;-)

Dave C

David Grant wrote:

>Quick and (very) nasty:
>
>$parts = split(".", $_SERVER['REMOTE_HOST']);
>if ($_SERVER['REMOTE_HOST'] == '127.0.0.1' || ($parts[0] == '192' &&
>$parts[1] == '168')) {
> // Local
>} else {
> // Remote
>}
>
>
>Dave Carrera wrote:
>
>
>>i know about
>>
>>$_SERVER['REMOTE_HOST']
>>
>>but i think i should of said how do i compare any address starting with
>>192.168.
>>
>>sorry if my first question was to vague
>>
>>
>>David Grant wrote:
>>
>>
>>
>>>Try $_SERVER['REMOTE_HOST'] instead of REFERER.
>>>
>>>Dave Carrera wrote:
>>>
>>>
>>>
>>>
>>>>Jay Blanchard wrote:
>>>>
>>>>
>>>>
>>>>
>>>>>[snip]
>>>>>Is there a way of sending users with a local ip address say 127.0.0.1
>>>>>and 192.168.xxx.xxx to goto one page and all other visitors to goto
>>>>>another?
>>>>>[/snip]
>>>>>
>>>>>
>>>>>Yes, there is.
>>>>>
>>>>>
>>>>>$_SERVER['REFERER'] will give you the referer mosy of the time. More
>>>>>info
>>>>>from TFM can be found here;
>>>>>
>>>>>http://us3.php.net/reserved.variables
>>>>>
>>>>>Header can then be used to redirect
>>>>>
>>>>>header("Location: http://www.example.com/"); /* Redirect browser */.
>>>>>More
>>>>>info from TFM can be found here;
>>>>>
>>>>>http://us3.php.net/header
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>
>>>>snip from TFM
>>>>
>>>>'HTTP_REFERER'
>>>>
>>>> The address of the page (if any) which referred the user agent to
>>>> the current page. This is set by the user agent. Not all user agents
>>>> will set this, and some provide the ability to modify HTTP_REFERER
>>>> as a feature. In short, it cannot really be trusted.
>>>>
>>>>notice the last 7 words !!!!
>>>>
>>>>
>>>>
>>>>
>>>
>>>
>>>
>>>
>
>
>
>

 

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

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