Solved

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

Posted on 2003-11-27
13
722 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
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 
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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
nagios 4 php error after installation 6 76
PHP 7 with IIs and SQL Server Windows 2008 Server failed to connect 8 54
Hacked File Timestamps 4 49
unset shopping cart session 15 31
Nothing in an HTTP request can be trusted, including HTTP headers and form data.  A form token is a tool that can be used to guard against request forgeries (CSRF).  This article shows an improved approach to form tokens, making it more difficult to…
This article discusses four methods for overlaying images in a container on a web page
The viewer will learn how to count occurrences of each item in an array.
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…

910 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

17 Experts available now in Live!

Get 1:1 Help Now