Solved

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

Posted on 2003-11-27
13
726 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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
Why Off-Site Backups Are The Only Way To Go

You are probably backing up your data—but how and where? Ransomware is on the rise and there are variants that specifically target backups. Read on to discover why off-site is the way to go.

 
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

Online Training Solution

Drastically shorten your training time with WalkMe's advanced online training solution that Guides your trainees to action. Forget about retraining and skyrocket knowledge retention rates.

Question has a verified solution.

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

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…
Build an array called $myWeek which will hold the array elements Today, Yesterday and then builds up the rest of the week by the name of the day going back 1 week.   (CODE) (CODE) Then you just need to pass your date to the function. If i…
Learn how to match and substitute tagged data using PHP regular expressions. Demonstrated on Windows 7, but also applies to other operating systems. Demonstrated technique applies to PHP (all versions) and Firefox, but very similar techniques will w…
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.

717 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