Author Topic: Invalid IP addresses returned  (Read 360 times)

0 Members and 1 Guest are viewing this topic.

Offline kickstartTopic starter

  • Guru
  • Addict
  • *
  • Posts: 2,680
    • View Profile
Invalid IP addresses returned
« on: July 29, 2010, 08:26:36 AM »
Hi

I have a couple of phpbb forums on my web space.

One is randomly throwing people off and it is getting far worse.

I have traced down the issue to the IP address. Phpbb stores the IP address and session id and checks that they match. If not it throws the user out. The session ids seem to be there OK, but the IP addresses aren't.

When it causes a problem the IP address seems to be returned as "::" (yes, 2 colons).

I have used the following routine to try and obtain a relevant IP address and it to returns "::"

Code: [Select]
function getRealIpAddr()
{
    if (!empty($_SERVER['HTTP_CLIENT_IP']))   //check ip from share internet
    {
      $ip=$_SERVER['HTTP_CLIENT_IP'];
    }
    elseif (!empty($_SERVER['HTTP_X_FORWARDED_FOR']))   //to check ip is pass from proxy
    {
      $ip=$_SERVER['HTTP_X_FORWARDED_FOR'];
    }
    else
    {
      $ip=$_SERVER['REMOTE_ADDR'];
    }
    return $ip;
}

Any ideas?

All the best

Keith
There are 10 types of people in the world. Those who understand binary and those who don't

Offline thorpe

  • Administrator
  • 'Mind Boggling!'
  • *
  • Posts: 29,255
    • View Profile
Re: Invalid IP addresses returned
« Reply #1 on: July 29, 2010, 07:57:02 PM »
I would suggest that these clients returning :: are using ipv6 instead of the more traditional ipv4.

My advice would be to report this as a bug to phpBB.

Offline kickstartTopic starter

  • Guru
  • Addict
  • *
  • Posts: 2,680
    • View Profile
Re: Invalid IP addresses returned
« Reply #2 on: July 30, 2010, 05:32:57 AM »
I would suggest that these clients returning :: are using ipv6 instead of the more traditional ipv4.

My advice would be to report this as a bug to phpBB.

IPv6 is my guess as well, but surely that should be returned in the server variables. I don't care too much what it is as long as it is consistent.

Unfortunately it is an old phpBB2 board so no longer supported.

All the best

Keith
There are 10 types of people in the world. Those who understand binary and those who don't

Offline kickstartTopic starter

  • Guru
  • Addict
  • *
  • Posts: 2,680
    • View Profile
Re: Invalid IP addresses returned
« Reply #3 on: July 30, 2010, 10:00:21 AM »
Hi

I have done a small mod to log the IP address of every visit.

Looking at that there is no pattern. If I visit a dozen times in a row, I might land up with 2/3 being recorded as "::" and 1/3 being my real IP address, or it might record them all fine.

I have another similar board on the same hosting account and that doesn't seem to have the same problem at all.

All the best

Keith
There are 10 types of people in the world. Those who understand binary and those who don't