1

How to get current logged windows username by php without windows authentication?

I have tried below all the functions before, it display server's username

<?php 
echo getenv("HOMEDRIVE") . getenv("HOMEPATH");

echo 'Current script owner: ' . get_current_user();

echo getenv("username"); 

echo    $_SERVER['LOGON_USER'];

    echo $_SERVER['AUTH_USER'];
    echo $_SERVER['REDIRECT_LOGON_USER'];
    echo $_SERVER['REDIRECT_AUTH_USER'];

?>
0m3r
  • 12,286
  • 15
  • 35
  • 71
Hara Prasad
  • 704
  • 6
  • 15
  • 2
    possible duplicate of [Can you get a Windows (AD) username in PHP?](http://stackoverflow.com/questions/168610/can-you-get-a-windows-ad-username-in-php) – Mihai Zinculescu Jun 19 '15 at 11:25
  • It's because script is executed inside server not client browser. I believe you wan't to create no-login authentication (Single Sing On) based on user who is logged on any PC inside domain... It's not hard to create connection between PHP and Active Directory and check if user can access AD and what groups it belongs etc. Then store logged in cookie, hashed password or whatever method you choose depending on security level needed (block that site from public network). You even can create custom groups inside AD and manage access and levels from it. – Pilskalns Jun 19 '15 at 16:52
  • By accessing AD from PHP I mean user has to enter his credentials in form (user name and password). If you are desperate, I can share ready to use script which allows / denies login based on user groups. – Pilskalns Jun 19 '15 at 16:55

0 Answers0