Home » Php » How to read Windows logged in username with PHP/IIS

How to read Windows logged in username with PHP/IIS

Posted by: admin July 12, 2020 Leave a comment

Questions:

I am running a network. Here I have a domain controller (DC) I just installed IIS6 , PHP and Mysql on it. every thing is working fine.:)

Now I want to bring up a script on this local website.
The first problem is that I want to detect which one of network users (active directory users) are logged in with PHP. I mean it is enough for me when the user is logged in to windows there is no need for another authentication.

I was wondering if I could just use a function or something… that its output is the AD username and user group.

How to&Answers:

If you’ve set IIS to authenticate users one or more of these should contain the username:

$_SERVER['LOGON_USER']
$_SERVER['AUTH_USER']
$_SERVER['REDIRECT_LOGON_USER']
$_SERVER['REDIRECT_AUTH_USER']