Re: Getting windows username into php/mysql

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxxxxxx> 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
>
>

-- 
PHP Windows Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[Index of Archives]     [PHP Home]     [PHP Users]     [PHP Database Programming]     [PHP Install]     [Kernel Newbies]     [Yosemite Forum]     [PHP Books]

  Powered by Linux