php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #13710 $REMOTE_ADDR works differently on different platforms
Submitted: 2001-10-17 05:53 UTC Modified: 2002-01-08 08:20 UTC
From: dreimann at ratio dot net Assigned:
Status: Not a bug Package: PHP options/info functions
PHP Version: 4.0.6 OS: 2.2.16C28_III #1 Mon Jul 30 22:0
Private report: No CVE-ID: None
 [2001-10-17 05:53 UTC] dreimann at ratio dot 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)

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2002-01-08 08:20 UTC] sander@php.net
I think you're doing something wrong. Ask support questions on the appropriate mailinglist.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Apr 25 12:01:31 2024 UTC