Jump to content

What reserved variable to use to return as close as possible to identity?


Recommended Posts

I think I might have already asked something similar, but...

my code has:

$ip = gethostbyaddr($_SERVER['REMOTE_ADDR']);
$host = $_SERVER['HTTP_HOST'];

my field header for "$host" is "VISITOR DOMAIN ADDRESS".  I'm not sure what I was thinking.  That's not possible to capture is it?  Last I read, and I think someone here told me, it is only possible to capture the IP and server name of the requesting computer?  the var $ip in my report, for instance, returns:

173-28-199-198.client.mchsi.com

if I visit the page, and that is the name of the server assigned to my ISP.  on PHP's doc page, there are the vars REMOTE_HOST and REMOTE_USER and I haven't tried those.  Their example does not list any return value for those vars.  what do they return?

Edited by ajetrumpet

Barand,

That's the same page I included in my post.  It says under REMOTE_USER that it returns the authenticated user.  what does that mean?   a remote user that has login credentials for the server they are requesting pages from?   also, under REMOTE_HOST, it says:

The Host name from which the user is viewing the current page. The reverse dns lookup is based on the REMOTE_ADDR of the user.
Note: Your web server must be configured to create this variable. For example in Apache you'll need HostnameLookups On inside httpd.conf for it to exist. See also gethostbyaddr().

I don't think I follow the first line of that.  what will a reverse DNS lookup do for me?  as u can see in my previous post, I am already using gethostbyaddr().  if I'm already using that, what will turning on HostnameLookups do for me as well?

so does that mean that I'll get the same thing from REMOTE_HOST that I get from gethostbyaddr(), which is what I'm using now?  the latter, like I said earlier, returns:

173-28-199-198.client.mchsi.com

 

Just now, ajetrumpet said:

is ur age showing a bit in that last post Barand?

Only if it means I am of a generation that is willing to try things out and learn by experimenting, research and trial and error (lots of error).

I didn't know the answer off the top of my head so I would have had to try it then relay the results of my trial to you. Or you could just as easily try it.

Barand,

I got an undefined index error.  does this perhaps mean i need to contact godaddy about needing "HostnameLookups" set to "On" inside the "httpd.conf" file?   I might not have access to that, just like I don't have access to my .ini file or the document root, as I'm on shared hosting.

undefined index.jpg

1 hour ago, ajetrumpet said:

does this perhaps mean i need to contact godaddy about needing "HostnameLookups" set to "On" inside the "httpd.conf" file?

If you did, they may not even enable it for you.  Doing a reverse-dns lookup on every request can cause quite the performance bottleneck and eat up bandwidth unnecessarily.   There's really not that much useful information to be gained from a reverse lookup in most cases so it's a bit pointless to even bother. For most people surfing the web, a reverse lookup with either a) fail and return no results or b) return some auto-generated host name that probably won't give you much more info than who there ISP is (if even that).

 

well this person's site doesn't get a lot of traffic kicken, as it only has like 12 pages on it I think, and most of the traffic he gets is from spiders and crawlers.  so it might not be a big performance issue with that small of a site.  i'll call godaddy and see what they say just for sh*ts and giggles.  i'd like to test the variable and see what it does return, as I don't know cuz i've never used it.

kicken,

cuz i'm on shared hosting, i do not have access to the default PHP.ini file or the "httpd.conf" file.  But the godaddy agent did say I could add a line in my own PHP.ini file that does what you say:  set "HostnameLookups" to "On.  If I did this, what does this statement look like?   Is it just a line of text that says "set HostnameLookups = true"??   or something different??

It's not something you can set in your php.ini file, it's an apache directive not a PHP directive.  Custom apache configurations are generally handled via a .htaccess file but only some directives are allowed in that file and as far as I know, this is not one of them.   Godaddy would have to modify the vhost configuration for your site on their end to enable their directive and I doubt they would bother with that.

Like I said before also, there is really not much point in enabling it.  Essentially it just causes apache to do exactly the same thing as what you did in your original post, a DNS lookup on the REMOTE_ADDR.  So if you really wanted to, you could just do it yourself via:

$_SERVER['REMOTE_HOST'] = gethostbyaddr($_SERVER['REMOTE_ADDR']);

 

  • Thanks 1

thanks man.  I will just take this field out of my report.  it doesn't sound like it's possible with the setup i've got.  I'll consider this issue solved.  thanks for everything!

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.