|
Prev: Market Picks
Next: Zend Optimizer Problem
From: "Alex Blundell" on 20 Mar 2006 15:45 HI, I have been searching the internet for days trying to find a way of getting the windows username (%username%) of the current logged on user and submitting it, along side some other information (entered into the form by the user), to a MysQl database. This will enable me to know who has submitted the form on my intranet. I have quite a bit of php/mysql knowledge, and i know the windows variable is %username% (easy i know) i just dont know how to get the variable into an array so i can post it to mysql db Any help would be great as im all out of place to look.... Thanks in advance
From: David Collard on 21 Mar 2006 11:30 I tried it using getenv('username') and it worked ok http://php.net/manual/en/function.getenv.php Alex Blundell wrote: > HI, I have been searching the internet for days trying to find a way of > getting the windows username (%username%) of the current logged on user and > submitting it, along side some other information (entered into the form by > the user), to a MysQl database. This will enable me to know who has > submitted the form on my intranet. > > I have quite a bit of php/mysql knowledge, and i know the windows variable > is %username% (easy i know) i just dont know how to get the variable into an > array so i can post it to mysql db > > > Any help would be great as im all out of place to look.... > > Thanks in advance > > > >
From: "Matt Murphy" on 21 Mar 2006 13:08 That seems to grab the user that apache is running under, any idea about the client's windows username? Matt > -----Original Message----- > From: David Collard [mailto:meizawotmeiz(a)gmail.com] > Sent: Tuesday, March 21, 2006 10:31 AM > To: Alex Blundell > Cc: php-windows(a)lists.php.net > Subject: Re: [PHP-WIN] Getting windows username into php/mysql > > I tried it using getenv('username') and it worked ok > http://php.net/manual/en/function.getenv.php > > Alex Blundell wrote: > > HI, I have been searching the internet for days trying to > find a way > > of getting the windows username (%username%) of the current > logged on > > user and submitting it, along side some other information (entered > > into the form by the user), to a MysQl database. This will > enable me > > to know who has submitted the form on my intranet. > > > > I have quite a bit of php/mysql knowledge, and i know the windows > > variable is %username% (easy i know) i just dont know how > to get the > > variable into an array so i can post it to mysql db > > > > > > Any help would be great as im all out of place to look.... > > > > Thanks in advance > > > > > > > > > > -- > PHP Windows Mailing List (http://www.php.net/) To > unsubscribe, visit: http://www.php.net/unsub.php > >
From: "Aaron Kenney" on 22 Mar 2006 00:21 I've had no luck with $_ENV['username'] or getenv('username'). Here's a page that I put together through suggestions using an Active X object. Name the page test.php. It requires IE so beware: <?PHP if (isset($_POST['username'])) { $username = $_POST['username']; echo "returned<br>"; echo $username; } else { echo "go"; echo " <html> <head> <title>testing username script</title> </head> <body> <form name='postvars' method='POST' action='test.php' onsubmit='submitform()'> <input type='hidden' name='username' value=''> </form> <script language=javascript><!-- var WshNetwork = new ActiveXObject(\"WScript.Network\"); document.postvars.username.value = WshNetwork.UserName; document.postvars.submit(); //--></script> </body> </html> "; } ?> -Aaron Kenney On 3/20/06, Alex Blundell <alexblundell(a)tiscali.co.uk> wrote: > HI, I have been searching the internet for days trying to find a way of > getting the windows username (%username%) of the current logged on user and > submitting it, along side some other information (entered into the form by > the user), to a MysQl database. This will enable me to know who has > submitted the form on my intranet. > > I have quite a bit of php/mysql knowledge, and i know the windows variable > is %username% (easy i know) i just dont know how to get the variable into an > array so i can post it to mysql db > > > Any help would be great as im all out of place to look.... > > Thanks in advance > > > > -- > PHP Windows Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > >
From: "Grinberg, Kevin" on 22 Mar 2006 09:11
I believe what you're looking for is: $_SERVER["REMOTE_USER"] However, it'll only work if the client is authenticated - if you allow anonymous access to the web site, the client will not be authenticated, so there's no Windows username to get (you can check the logs to find out). The details vary depending on your web server and client - IIS/IE is easiest (on Windows), but I have it working with Apache/Firefox, so it's not platform-exclusive. E-mail me directly if you're having issues with that, as it doesn't really belong on this list... -----Original Message----- From: Matt Murphy [mailto:mmurphy(a)tc-tech.com] Sent: Tuesday, March 21, 2006 1:09 PM To: php-windows(a)lists.php.net Subject: RE: [PHP-WIN] Getting windows username into php/mysql That seems to grab the user that apache is running under, any idea about the client's windows username? Matt > -----Original Message----- > From: David Collard [mailto:meizawotmeiz(a)gmail.com] > Sent: Tuesday, March 21, 2006 10:31 AM > To: Alex Blundell > Cc: php-windows(a)lists.php.net > Subject: Re: [PHP-WIN] Getting windows username into php/mysql > > I tried it using getenv('username') and it worked ok > http://php.net/manual/en/function.getenv.php > > Alex Blundell wrote: > > HI, I have been searching the internet for days trying to > find a way > > of getting the windows username (%username%) of the current > logged on > > user and submitting it, along side some other information (entered > > into the form by the user), to a MysQl database. This will > enable me > > to know who has submitted the form on my intranet. > > > > I have quite a bit of php/mysql knowledge, and i know the windows > > variable is %username% (easy i know) i just dont know how > to get the > > variable into an array so i can post it to mysql db > > > > > > Any help would be great as im all out of place to look.... > > > > Thanks in advance > > > > > > > > > > -- > PHP Windows Mailing List (http://www.php.net/) To unsubscribe, visit: > http://www.php.net/unsub.php > > |