Solved

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

Posted on 2003-11-27
13
725 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
Salesforce Has Never Been Easier

Improve and reinforce salesforce training & adoption using WalkMe's digital adoption platform. Start saving on costly employee training by creating fast intuitive Walk-Thrus for Salesforce. Claim your Free Account Now

 
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

Creating Instructional Tutorials  

For Any Use & On Any Platform

Contextual Guidance at the moment of need helps your employees/users adopt software o& achieve even the most complex tasks instantly. Boost knowledge retention, software adoption & employee engagement with easy solution.

Question has a verified solution.

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

Deprecated and Headed for the Dustbin By now, you have probably heard that some PHP features, while convenient, can also cause PHP security problems.  This article discusses one of those, called register_globals.  It is a thing you do not want.  …
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…
The viewer will learn how to dynamically set the form action using jQuery.
The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …

733 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