Getting computer name and/or login
| From: | Joseph Szobody | Date: | Sat, 03 May 2003 16:20:35 +0000 |
| Subject: | Getting computer name and/or login | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-146281@lists.php.net to get a copy of this message | ||
Folks,
I'm looking to get a user's computer name and/or login name. This is for an internal app,
all computers would be on the local network with the server.
I'm able to get the computer name by extracting it from tracert:
exec("tracert " . $REMOTE_ADDR,$result);
preg_match("/Tracing route to (.*) /",$result[1],$name);
echo "Your computer name is: <b>" . strtolower($name[1]) . "</b>";
However this only works on Win. My linux box won't give me a computer name (using traceroute).
Anyone know of a way I could do this in linux?
Secondly, and I'm not sure this is even possible, can I somehow get the login name of a user?
Joseph