[FX.php List] Capturing IP for a choice calc

DC dan.cynosure at dbmscan.com
Wed Mar 1 16:12:50 MST 2006


that's a new one to me! there's no mention of that server variable on 
PHP.net except for a bug report from 2003 that is marked as bogus. no 
wonder it caused you much head scratching...

i looked around google:
http://www.google.com/search?q=%2BHTTP_PC_REMOTE_ADDR+%2Bphpinfo

and found that the server variable HTTP_PC_REMOTE_ADDR is only found on 
OSX sites running Apache 1.3x so it probably isn't a good idea to rely 
on this either. i didn't find a good explanation for its existence either.

btw, don't be like these poor souls and leave your phpinfo() sitting 
around for googlebot to find and index!

YMMV,
dan

Kevin Futter had written:
> Hi Peter,
> 
> Firstly, just a quick word about using the $_SERVER['REMOTE_ADDR'] - 
> don’t! Why? I notice you’re using an OS X Tiger server (as do we for our 
> testing box). 10.4 Server does NOT capture the remote address in this 
> variable. Instead it uses $_SERVER['HTTP_PC_REMOTE_ADDR']. I learned 
> this the hard way after much head scratching! To make my code portable, 
> I use this:
> 
> 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'];
> 
> Now, the easiest way to filter IP addresses for internal/external access 
> is to use your gateway’s IP address. For instance, if it’s internal NIC 
> happens to be 192.168.0.1, then simply filter on that. All external 
> requests to your internal webserver (assuming your webserver **is** 
> internal) will be seen as coming from this address, so just disallow 
> these requests in your code. If it’s any other address, it will be by 
> definition internal, and OK. It’s how we do it for several of our 
> resources, and it works beautifully.
> 
> Kevin
> 
> On 2/3/06 2:11 AM, "Peter Bates" <p.bates at sjcpl.org> wrote:
> 
>     I'm building a solution that contains some copyrighted material on
>     our website. We have permission to share the copyrighted material
>     with our patrons while they are in one of our building, but not if
>     they are accessing the site from outside the building. I'm assuming
>     that I need to capture the requesting IP address before the data is
>     displayed that basically does the following:
> 
>     If IP = Our in-house IP range         <!-- We have our own in-house
>     network, inside and outside DNS servers, web server, etc. -->
>        Show data from field "x"             <!-- This would be actually
>     a link that is stored in a FMP field. -->
>     Else
>        Show "We're sorry, but due to copyright restrictions, this
>     material is only available in one of our library branches"   <!--
>     This would be displayed in place of the data from  field "x" -->
>     End If
> 
>     As I am still floundering around using FileMaker Pro with FX.php, I
>     would deeply appreciate any help that could point me into the right
>     direction to code this.
> 
>     Mac OS X Server 10.4x, FileMaker Server Advanced 8x, PHP 4.x
> 
>     Thanks,
>     Peter
> 
>     Peter Bates
>     Microcomputer Network Specialist
>     Automated Services
>     St. Joseph County Public Library
>     304 S. Main St.
>     South Bend, IN  46601
>     voice: (574) 282-4610
>     fax: (574) 282-4662
>     e-mail: p.bates at sjcpl.org <mailto:p.bates at sjcpl.org>
>     www:  http:/www.libraryforlife.org <http:/www.libraryforlife.org>
>     library catalog:
>     http://www.libraryforlife.org/onlinecatalog/onlinecatalog.html
>     <http://www.libraryforlife.org/onlinecatalog/onlinecatalog.html>
> 
>      
> 
> 
>     ------------------------------------------------------------------------
>     _______________________________________________
>     FX.php_List mailing list
>     FX.php_List at mail.iviking.org
>     http://www.iviking.org/mailman/listinfo/fx.php_list
> 
> 
> 
> 
> -- 
> Kevin Futter
> Webmaster, St. Bernard's College
> http://www.sbc.melb.catholic.edu.au/
> 
> 
> ------------------------------------------------------------------------
> 
> _______________________________________________
> 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