Solved

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

Posted on 2003-11-27
13
721 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
 
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
IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

 
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

Do You Know the 4 Main Threat Actor Types?

Do you know the main threat actor types? Most attackers fall into one of four categories, each with their own favored tactics, techniques, and procedures.

Join & Write a Comment

Author Note: Since this E-E article was originally written, years ago, formal testing has come into common use in the world of PHP.  PHPUnit (http://en.wikipedia.org/wiki/PHPUnit) and similar technologies have enjoyed wide adoption, making it possib…
This article discusses four methods for overlaying images in a container on a web page
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.
The viewer will learn how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…

707 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

Need Help in Real-Time?

Connect with top rated Experts

15 Experts available now in Live!

Get 1:1 Help Now