RE: [PHP] Getting computer name and/or login

From: Date: Sat, 03 May 2003 16:35:22 +0000
Subject: RE: [PHP] Getting computer name and/or login
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-146284@lists.php.net to get a copy of this message
> 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? On Windows networks, you can usually get the name of the logged on user with $_SERVER['LOGON_USER']. Whether any of this is going to be set though is going to depend upon your server. Best bet is to look at the output of phpinfo() for what you need. ---John W. Holmes... PHP Architect - A monthly magazine for PHP Professionals. Get your copy today. http://www.phparch.com/

« previous php.general (#146284) next »