Bug #13710: $REMOTE_ADDR works differently on different platforms
| From: | dreimann at ratio dot net | Date: | Wed, 17 Oct 2001 09:53:32 +0000 |
| Subject: | Bug #13710: $REMOTE_ADDR works differently on different platforms | ||
| Groups: | php.dev | ||
| Request: | Send a blank email to php-dev+get-68108@lists.php.net to get a copy of this message | ||
From: dreimann@ratio.net
Operating system: 2.2.16C28_III #1 Mon Jul 30 22:0
PHP version: 4.0.6
PHP Bug Type: PHP options/info functions
Bug description: $REMOTE_ADDR works differently on different platforms
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 bug report at: http://bugs.php.net/?id=13710&edit=1