tonelm54
asked on
Get windows username under IIS
Im trying to create a simple page, and at the top say
I would like to get the windows username and replace user in Welcome, so for example 'Welcome tcross'.
Reading some documents this should be easy as Im using PHP under IIS, so I should be able to use:-
But all I get is:-
Is there something Im missing? Is there something I need to enable in IIS?
Thank you
Welcome User
I would like to get the windows username and replace user in Welcome, so for example 'Welcome tcross'.
Reading some documents this should be easy as Im using PHP under IIS, so I should be able to use:-
<?php
echo $_SERVER['LOGON_USER'];
echo $_SERVER['AUTH_USER'];
echo $_SERVER['REDIRECT_LOGON_USER'];
echo $_SERVER['REDIRECT_AUTH_USER'];
?>
But all I get is:-
Notice: Undefined index: REDIRECT_LOGON_USER in C:\inetpub\wwwroot\test.php on line 4
Notice: Undefined index: REDIRECT_AUTH_USER in C:\inetpub\wwwroot\test.php on line 5
Is there something Im missing? Is there something I need to enable in IIS?
Thank you
did you enable Integrated windows authentication instead of anonymous access?
ASKER
Ok, well that was my first mistake then. Installed it and it now works if I do it from the localhost and displays my username great. However if I access the page from different machines, I get:-
Any ideas?
Thank you
401 - Unauthorized: Access is denied due to invalid credentials.
Any ideas?
Thank you
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.