Re: Catching usernames or computer names..

From: Date: Thu, 08 Aug 2002 18:19:45 +0000
Subject: Re: Catching usernames or computer names..
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-111702@lists.php.net to get a copy of this message
"Adam Plocher" <aplocher@erepublic.com> wrote in message news:BD9C6995EC9DD4119F3000500461631E149D8B@mail.govtech.net... > I have an intranet site setup here at my work and I want to make it grab the > users Windows username. This way users won't have to login to the intranet > site and the site will recognize them. > I wouldn't know how to do the Win thing... I've only been using it in a Programming sense for 4 months... (I'm used to Linux) There may be ways linking it with the exec() function that executes Shell commands (Dos commands in Windows I believe)... If you know how to attain this goal via dos, then it can be done... > If there's no way to do this, is it be possible to grab their computer name? > You can however, grab their I.P. (I am also not sure about the Computer name...) I did this once, it returned the localhost name of My Computer as opposed to its actual assigned name... Herez a Snippet $host = ""; $ip = ""; if(getenv('HTTP_X_FORWARDED_FOR')){ $ip = getenv('HTTP_X_FORWARDED_FOR'); $host = gethostbyaddr($ip); }else{ $ip = getenv('REMOTE_ADDR'); $host = gethostbyaddr($ip); } echo "$host is the host Name of Your Computer and its IP Number is $ip"; "Got this off the main php website..." > Thanks > -Adam >

« previous php.general (#111702) next »