[FX.php List] [OFF] Getting visitor's IP

Bob Patin bob at patin.com
Thu Aug 21 19:46:51 MDT 2008


Kevin,

Thanks, that's the command Jonathan Schwartz sent me; I don't need to  
list them both in my code then, do I, since I'm using OS X Server?

Can't I just use the one that works and forget about REMOTE_ADDR?

Bob Patin
Longterm Solutions
bob at longtermsolutions.com
615-333-6858
http://www.longtermsolutions.com
iChat: bobpatin
AIM: longterm1954
FileMaker 9 Certified Developer
Member of FileMaker Business Alliance and FileMaker TechNet
--------------------------
FileMaker hosting and consulting for all versions of FileMaker
PHP • Full email services • Free DNS hosting • Colocation • Consulting

On Aug 21, 2008, at 8:07 PM, Kevin Futter wrote:

> On 22/08/08 1:46 AM, "Bob Patin" <bob at patin.com> wrote:
>
>> Strange... I know that I used this a couple of years ago.
>>
>> Could there be a setting on my web server that would change this
>> behavior? Would it be a PHP setting or possibly something in the
>> server itself (Mac OS X Server/Apache)?
>>
>> If anyone knows, I'd appreciate some guidance.
>>
>
> Hi Bob,
>
> The problem is that Mac OS X Server stores this info in a non-standard
> variable. You're probably testing for:
>
> $_SERVER['REMOTE_ADDR']
>
> Whereas OS X Server uses:
>
> $_SERVER['HTTP_PC_REMOTE_ADDR']
>
> Been there and done that one.
>
> I now normalise the two of them thusly:
>
> if (isset($_SERVER['HTTP_PC_REMOTE_ADDR']))
> {
> // OS X Server uses HTTP_PC_REMOTE_ADDR to store user IP
>
> $_SERVER['REMOTE_ADDR'] = $_SERVER['HTTP_PC_REMOTE_ADDR'];
> }
>
> $ip = $_SERVER['REMOTE_ADDR'];
>
> Hope this helps!
>
>
> -- 
> Kevin Futter
> Webmaster, St. Bernard's College
> http://www.sbc.melb.catholic.edu.au/
>
>
> #####################################################################################
> This e-mail message has been scanned for Viruses and Content and  
> cleared
> by MailMarshal
> #####################################################################################
>
> This e-mail and any attachments may be confidential. You must not  
> disclose or use the information in this e-mail if you are not the  
> intended recipient. If you have received this e-mail in error,  
> please notify us immediately and delete the e-mail and all copies.  
> The College does not guarantee that this e-mail is virus or error  
> free.  The attached files are provided and may only be used on the  
> basis that the user assumes all responsibility for any loss, damage  
> or consequence resulting directly or indirectly from the use of the  
> attached files, whether caused by the negligence of the sender or  
> not. The content and opinions in this e-mail are not necessarily  
> those of the College.
> _______________________________________________
> FX.php_List mailing list
> FX.php_List at mail.iviking.org
> http://www.iviking.org/mailman/listinfo/fx.php_list



More information about the FX.php_List mailing list