Solved

How to get the machine name who visits the file.php

Posted on 2003-11-27
13
723 Views
Last Modified: 2012-08-13
well, i need to know how i must do to get the Machine Name from the visitor

for ex: my pc name is Icarus

the php will print "Icarus"
0
Comment
Question by:paStiSSet
  • 8
  • 4
13 Comments
 
LVL 3

Expert Comment

by:ashoooo
ID: 9839193
$machine_name = gethostbyaddr($_SERVER["REMOTE_ADDR"]);

Hope this helps
0
 
LVL 1

Author Comment

by:paStiSSet
ID: 9839818
nope, it gets the host
0
 
LVL 3

Expert Comment

by:ashoooo
ID: 9839827
Does it give the IP address?
0
NAS Cloud Backup Strategies

This article explains backup scenarios when using network storage. We review the so-called “3-2-1 strategy” and summarize the methods you can use to send NAS data to the cloud

 
LVL 1

Author Comment

by:paStiSSet
ID: 9839977
i don't want the ip address, im askin for a scipt wich prints the machine name.
machine name means the PC name (lan pc name), ok?
0
 
LVL 3

Expert Comment

by:ashoooo
ID: 9840037
Thats what I am saying... gethostbyaddr($_SERVER["REMOTE_ADDR"]); does just that. Unless ofcourse there is no hostname for the particular IP address. OK?
0
 
LVL 1

Author Comment

by:paStiSSet
ID: 9840129
so, obviously that's not what i want, thx
0
 
LVL 3

Expert Comment

by:ashoooo
ID: 9840142
Do you mean to say that gethostbyaddr DOES NOT give you the machine name? Tell me that I'm a fool for using the function all this time in my scripts.
0
 
LVL 3

Expert Comment

by:ashoooo
ID: 9840160
So much for trying to help people...
0
 
LVL 1

Author Comment

by:paStiSSet
ID: 9840201
it returns:
XX.XX.XX.XXX.proxycache.rima-tde.net

thats not what i want >:(
0
 
LVL 3

Expert Comment

by:ashoooo
ID: 9841289
It depends on how your website is accessed by the remote client. If he/she accesses it over the internet (using http://www.remotehost.com) then, you get the above name. If he/she accesses it using http://intranetname, then you get the actual machine name.

It all depends on how your server recognizes the remote machine.
0
 
LVL 1

Accepted Solution

by:
m0nk3y earned 50 total points
ID: 9842720
and to add to the previous comment, i dont' think it's possible to get the machine name if the domain is the internet; it's a security feature (not of php, of the client). You could of course, get the ip of the machine and then do some crazy ping/lookup or something liket that, but if it's going through a router or a proxy i doubt that would work either.
0
 
LVL 3

Expert Comment

by:ashoooo
ID: 9848142
True...
0
 
LVL 3

Expert Comment

by:ashoooo
ID: 9850207
Just out of curiousity, can you tell me how my answer was different from the one you accepted?
0

Featured Post

DevOps Toolchain Recommendations

Read this Gartner Research Note and discover how your IT organization can automate and optimize DevOps processes using a toolchain architecture.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Part of the Global Positioning System A geocode (https://developers.google.com/maps/documentation/geocoding/) is the major subset of a GPS coordinate (http://en.wikipedia.org/wiki/Global_Positioning_System), the other parts being the altitude and t…
Introduction This article is intended for those who are new to PHP error handling (https://www.experts-exchange.com/articles/11769/And-by-the-way-I-am-New-to-PHP.html).  It addresses one of the most common problems that plague beginning PHP develop…
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.
This tutorial will teach you the core code needed to finalize the addition of a watermark to your image. The viewer will use a small PHP class to learn and create a watermark.

777 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question