ajetrumpet Posted November 23, 2019 Share Posted November 23, 2019 (edited) 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 November 23, 2019 by ajetrumpet Quote Link to comment https://forums.phpfreaks.com/topic/309570-what-reserved-variable-to-use-to-return-as-close-as-possible-to-identity/ Share on other sites More sharing options...
Barand Posted November 23, 2019 Share Posted November 23, 2019 Not all server vars are always available. See https://www.php.net/manual/en/reserved.variables.server.php Quote Link to comment https://forums.phpfreaks.com/topic/309570-what-reserved-variable-to-use-to-return-as-close-as-possible-to-identity/#findComment-1571830 Share on other sites More sharing options...
ajetrumpet Posted November 23, 2019 Author Share Posted November 23, 2019 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? Quote Link to comment https://forums.phpfreaks.com/topic/309570-what-reserved-variable-to-use-to-return-as-close-as-possible-to-identity/#findComment-1571833 Share on other sites More sharing options...
Barand Posted November 23, 2019 Share Posted November 23, 2019 A DNS lookup converts the domain name you enter into your browser into an ip address. A reverse lookup does it the opposite way round (IP ==> domain name) Quote Link to comment https://forums.phpfreaks.com/topic/309570-what-reserved-variable-to-use-to-return-as-close-as-possible-to-identity/#findComment-1571834 Share on other sites More sharing options...
ajetrumpet Posted November 23, 2019 Author Share Posted November 23, 2019 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 Quote Link to comment https://forums.phpfreaks.com/topic/309570-what-reserved-variable-to-use-to-return-as-close-as-possible-to-identity/#findComment-1571835 Share on other sites More sharing options...
Barand Posted November 23, 2019 Share Posted November 23, 2019 Whenever I have a question like that I try it and see. Quote Link to comment https://forums.phpfreaks.com/topic/309570-what-reserved-variable-to-use-to-return-as-close-as-possible-to-identity/#findComment-1571837 Share on other sites More sharing options...
ajetrumpet Posted November 23, 2019 Author Share Posted November 23, 2019 is ur age showing a bit in that last post Barand? 😃 No worries, I will give it a shot. That's fair I spose. Quote Link to comment https://forums.phpfreaks.com/topic/309570-what-reserved-variable-to-use-to-return-as-close-as-possible-to-identity/#findComment-1571838 Share on other sites More sharing options...
Barand Posted November 23, 2019 Share Posted November 23, 2019 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. Quote Link to comment https://forums.phpfreaks.com/topic/309570-what-reserved-variable-to-use-to-return-as-close-as-possible-to-identity/#findComment-1571840 Share on other sites More sharing options...
ajetrumpet Posted November 23, 2019 Author Share Posted November 23, 2019 don't waste ur time. i will do it and get back to u. thanks. Quote Link to comment https://forums.phpfreaks.com/topic/309570-what-reserved-variable-to-use-to-return-as-close-as-possible-to-identity/#findComment-1571844 Share on other sites More sharing options...
ajetrumpet Posted November 24, 2019 Author Share Posted November 24, 2019 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. Quote Link to comment https://forums.phpfreaks.com/topic/309570-what-reserved-variable-to-use-to-return-as-close-as-possible-to-identity/#findComment-1571845 Share on other sites More sharing options...
kicken Posted November 24, 2019 Share Posted November 24, 2019 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). Quote Link to comment https://forums.phpfreaks.com/topic/309570-what-reserved-variable-to-use-to-return-as-close-as-possible-to-identity/#findComment-1571846 Share on other sites More sharing options...
ajetrumpet Posted November 24, 2019 Author Share Posted November 24, 2019 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. Quote Link to comment https://forums.phpfreaks.com/topic/309570-what-reserved-variable-to-use-to-return-as-close-as-possible-to-identity/#findComment-1571847 Share on other sites More sharing options...
ajetrumpet Posted November 24, 2019 Author Share Posted November 24, 2019 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?? Quote Link to comment https://forums.phpfreaks.com/topic/309570-what-reserved-variable-to-use-to-return-as-close-as-possible-to-identity/#findComment-1571856 Share on other sites More sharing options...
kicken Posted November 24, 2019 Share Posted November 24, 2019 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']); 1 Quote Link to comment https://forums.phpfreaks.com/topic/309570-what-reserved-variable-to-use-to-return-as-close-as-possible-to-identity/#findComment-1571865 Share on other sites More sharing options...
ajetrumpet Posted November 25, 2019 Author Share Posted November 25, 2019 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! Quote Link to comment https://forums.phpfreaks.com/topic/309570-what-reserved-variable-to-use-to-return-as-close-as-possible-to-identity/#findComment-1571866 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.