Bug #13710 Updated: $REMOTE_ADDR works differently on different platforms
| From: | sander@php.net | Date: | Tue, 08 Jan 2002 13:20:01 +0000 |
| Subject: | Bug #13710 Updated: $REMOTE_ADDR works differently on different platforms | ||
| References: | 1 | Groups: | php.dev |
| Request: | Send a blank email to php-dev+get-76259@lists.php.net to get a copy of this message | ||
ID: 13710
Updated by: sander
Reported By: dreimann@ratio.net
Old Status: Open
Status: Bogus
Bug Type: PHP options/info functions
Operating System: 2.2.16C28_III #1 Mon Jul 30 22:0
PHP Version: 4.0.6
New Comment:
I think you're doing something wrong. Ask support questions on the
appropriate mailinglist.
Previous Comments:
------------------------------------------------------------------------
[2001-10-17 05:53:31] dreimann@ratio.net
I have used the following little code in many php pages on:
Linux 2.2.13 #1 SMP Thu Nov 9 10:30:50 EST 2000 i686 unknown
with php 3.x as you can see at
http://www.consumersadvantage.com/phpinfo.php
<?
if (strcasecmp($REMOTE_ADDR,"65.34.212.5") != 0)
{
header("Location: http://www.ratio.net/");
exit;
}
?>
So we are migrating to a new platform:
Linux 2.2.16C28_III #1 Mon Jul 30 22:07:58 PDT 2001 i586 unknown
as you can see at http://annapolis.hostastic.com/phpinfo.php
and that code snippet no longer works on the new platform. So,
referring to the manual at:
http://www.php.net/manual/en/function.getenv.php
indicates that I should do the following:
<?
unset($ipaddress);
$ipaddress = getenv("REMOTE_ADDR");
if (strcasecmp($ipaddress,"65.34.212.5") != 0)
{
header("Location: http://www.ratio.net/");
exit;
}
?>
but that doesn't work either, but this does work:
<?
unset($ipaddress);
$ipaddress = getenv($REMOTE_ADDR);
if (strcasecmp($ipaddress,"65.34.212.5") != 0)
{
header("Location: http://www.ratio.net/");
exit;
}
?>
So, either the manual is wrong or something else is wrong. Please let
me know if I can provide any further information.
Best Regards,
Ratio Corp.,
Daniel F. Reimann
dreimann@ratio.net
954-783-7123 (voice)
954-252-3811 (fax)
------------------------------------------------------------------------
Edit this bug report at http://bugs.php.net/?id=13710&edit=1