The Cache: Technology Expert's Forum
 
*
Welcome, Guest. Please login or register. September 10, 2010, 10:39:07 AM

Login with username, password and session length


Pages: [1] 2
  Print  
Author Topic: $_SERVER['REMOTE_ADDR'] is empty? how the??  (Read 1716 times)
nutballs
Administrator
Lifer
*****
Offline Offline

Posts: 5331


DAMN YOU!!!!!!!


View Profile
« on: September 24, 2009, 03:51:44 PM »

How is this possible?

I get that it can be supplied by user, and as such, spoofed. But... whats the point in it being blank?
I always assumed it was coming from apache?
And that apache was getting it from the packet.
I guess that cant be true though now that I think about it, because every packet could technically have a different IP on a multiplexed network or whatever its called.

So, any way to get the user's IP address when a $_SERVER['REMOTE_ADDR'] is blank? Like the packet return address?
Logged
perkiset
Olde World Hacker
Administrator
Lifer
*****
Online Online

Posts: 8767



View Profile
« Reply #1 on: September 24, 2009, 04:03:56 PM »

I've never seen that... is this a packet from (somewhere out there)? From you? What's the code look like?
Logged

It's the things you learn after you know it all that really count.
-John Wooden
nutballs
Administrator
Lifer
*****
Offline Offline

Posts: 5331


DAMN YOU!!!!!!!


View Profile
« Reply #2 on: September 24, 2009, 04:09:18 PM »

its just people hitting my websites.
I get blank $_SERVER['REMOTE_ADDR'] all day long
maybe 100 a day.

I am trying this to see if it remedies it:
function getIpAddress() {
return (empty(
$_SERVER['HTTP_CLIENT_IP'])?(empty($_SERVER['HTTP_X_FORWARDED_FOR'])?
$_SERVER['REMOTE_ADDR']:$_SERVER['HTTP_X_FORWARDED_FOR']):$_SERVER['HTTP_CLIENT_IP']);
}
Logged
perkiset
Olde World Hacker
Administrator
Lifer
*****
Online Online

Posts: 8767



View Profile
« Reply #3 on: September 24, 2009, 04:27:36 PM »

Hmmmm... I'll be really interested to see if that bears fruit.

I have not used this myself, but you might play with the php wrapper and the stdin: http://us2.php.net/manual/en/wrappers.php.php

... it's an alternate way of getting the information being passed into (this) php instance.
Logged

It's the things you learn after you know it all that really count.
-John Wooden
nutballs
Administrator
Lifer
*****
Offline Offline

Posts: 5331


DAMN YOU!!!!!!!


View Profile
« Reply #4 on: September 24, 2009, 04:44:58 PM »

bah didnt fix it. I just got one with a blank again.

no ref and a user agent of Java/1.6.0_07
though, the agent is usually normal browser strings.

i dont get it.
I wonder, could it be IPcop?
Logged
perkiset
Olde World Hacker
Administrator
Lifer
*****
Online Online

Posts: 8767



View Profile
« Reply #5 on: September 24, 2009, 04:55:56 PM »

I don't have that problem behind IP Cop ... I did when I was using Apache itself to proxy backwards into a rendering array, but never from IPCop.

This is bugging me, so I googled a bit and can find some discussion on it, but no answers at all. Some interesting tidbits though - is this in windows or nix? I don't know how to check, but could it be an incorrect interpretation of an IPv6 thang?

If you run your function and don't get any $ip, perhaps you should iterate through getHeaders and dump everything about the packet you see so that we might be able to get a feel for what's going on.
Logged

It's the things you learn after you know it all that really count.
-John Wooden
Bompa
Administrator
Expert
*****
Online Online

Posts: 394


View Profile WWW
« Reply #6 on: September 24, 2009, 04:58:21 PM »

its just people hitting my websites.
I get blank $_SERVER['REMOTE_ADDR'] all day long
maybe 100 a day.

Something wrong with that server, imo.
Logged

Do You Know?
nutballs
Administrator
Lifer
*****
Offline Offline

Posts: 5331


DAMN YOU!!!!!!!


View Profile
« Reply #7 on: September 24, 2009, 05:12:51 PM »

these are remote nodes, phoning home with info about the surfer.
They are all linux, assorted flavors. actually though, that just made me wonder if it is only 1 of the remotes???

hmmm gotta go check that.
Logged
Bompa
Administrator
Expert
*****
Online Online

Posts: 394


View Profile WWW
« Reply #8 on: September 24, 2009, 05:26:17 PM »

You've probably already done this, but...

"That's weird, check whats into $_SERVER array and post it here"
~ http://www.phpfreaks.com/forums/index.php?topic=110207.0

The "blank" ip showed in the array for that guy.

I dunno.

Logged

Do You Know?
perkiset
Olde World Hacker
Administrator
Lifer
*****
Online Online

Posts: 8767



View Profile
« Reply #9 on: September 24, 2009, 05:31:59 PM »

I found the same post... but they din't really answer him fundamentally. In fact, all entries related to this topic seem to simply say something like, you're not using the $_SERVER variable correctly or something.

Logged

It's the things you learn after you know it all that really count.
-John Wooden
Bompa
Administrator
Expert
*****
Online Online

Posts: 394


View Profile WWW
« Reply #10 on: September 24, 2009, 05:44:16 PM »

I found the same post... but they din't really answer him fundamentally. In fact, all entries related to this topic seem to simply say something like, you're not using the $_SERVER variable correctly or something.



Yah, his own code had a mistake, but my point is the IP showed elsewhere.

Also, are we to understand that the raw server logs show no IP?

Bompa
Logged

Do You Know?
nutballs
Administrator
Lifer
*****
Offline Offline

Posts: 5331


DAMN YOU!!!!!!!


View Profile
« Reply #11 on: September 24, 2009, 07:23:54 PM »

I cannot reproduce it myself, only happens with the occasional user.

I gotta check the logs but the prospect of checking them all, sucks. So now that I realized it might be just 1 server hopefully, I will check those logs. Once I figure out which server it is. Hopefully.

I also can't print the server array because it's not me causing it. It's only 1 out of 1000 about.
Logged
nutballs
Administrator
Lifer
*****
Offline Offline

Posts: 5331


DAMN YOU!!!!!!!


View Profile
« Reply #12 on: September 24, 2009, 08:58:11 PM »

BAH. its on all my servers. lol

Logged
nutballs
Administrator
Lifer
*****
Offline Offline

Posts: 5331


DAMN YOU!!!!!!!


View Profile
« Reply #13 on: September 24, 2009, 09:17:03 PM »

ok interesting. The IP is in the log file.

So im a bit lost.

basically, when a user/bot hits my remote sites, they do a file_get_contents to a magic URL. That URL is my mothership. A bunch of info is passed, 1 of which is the IP of the user. I guess something could be going wrong there, but I am getting all the other items, like the agent string and url and other stuff.

bah I hate this kind of shit.
Logged
kurdt
Lifer
*****
Online Online

Posts: 1021


it's all part of the plan


View Profile
« Reply #14 on: September 24, 2009, 10:39:43 PM »

I know! Your visitors don't have IPs. Not everybody is born rich and they still want to use the interwebz.
Logged

Coming up with new features is easy - inventing features that replace old features is hard.
Pages: [1] 2
  Print  
 
Jump to:  

Perkiset's Place Home   Best of The Cache   phpMyIDE: MySQL Stored Procedures, Functions & Triggers
Politics @ Perkiset's   Pinkhat's Perspective   
cache
mart
coder
programmers
ajax
php
javascript
Powered by MySQL Powered by PHP Powered by SMF 1.1.2 | SMF © 2006-2007, Simple Machines LLC
Seo4Smf v0.2 © Webmaster's Talks


Valid XHTML 1.0! Valid CSS!