Jump to content

INCORRECT CLIENT IPS


tester07

Recommended Posts

Hello,

 

I've been writing scripts for 2 or 3 years on PHP and I can say that i am on pre intermediate level.

Well, my site was working as it should since 12/09, then i got following records from my web admin panel.

 

login:2/2 13:44:18

logout:1/1 03:00:00

act:1 1

ip:1.0.5.211 ?

location: unknown ?

url: URL

agent: Mozilla/5.0 (compatible; Googlebot/2.1; +http://www.google.com/bot.html)

 

ip is not only this, its like stupid numbers 0.0.5.48 or so.

 

How i get ips from apache is:

<?php

$client = isset($_SERVER['HTTP_X_FORWARDED_FOR']) ? $_SERVER['HTTP_X_FORWARDED_FOR'] : $_SERVER['REMOTE_ADDR'];

echo $client;

?>

 

Ive got crazy about this problem. But its not only that, it doesnt give this ip type always, sometimes stupid ips sometimes not.

 

The problem is, how can i fix it? Are there any other ways to get client ips? or am i wrong about getting ip method?

 

any help would be greatefull.

Link to comment
https://forums.phpfreaks.com/topic/190652-incorrect-client-ips/
Share on other sites

IPs and User Agents can be easily spoofed, Especially from btos such as your GoogleBot you have listed.

One thing I would check, Google does not usually spoof their bot IP, so you could either have an issue with receiving your IP (Althought that is the same code I have used for years) or someone is pretending to be Google bot.

Not much you can do about people forging ip addresses. Its not normally of much use to a client however as I said, becuase they can't receive a response if they give you the wrong address.

 

If even your own ip address however is playing up then there is something definitely wrong, what though, I have no idea. What ip is Apache set to listen on? Has it recently been changed to ipv6?

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.