Jump to content

Retrieving Windows UserName


dmccabe

Recommended Posts

I am busy customising a wordpress install to use as a staff intranet.

 

However I would really like to be able to capture the users username that they login to the domain as.

 

I read a page stating it might be possible with:

$_SERVER['LOGON_USER'] and $_SERVER['AUTH_USER']. Might only work with IE

 

however they suggested checking what info php was capturing by looking at phpinfo()

 

I have checked it and there is no mention of username.

 

Is there anyway I can get this to capture the username?

Link to comment
https://forums.phpfreaks.com/topic/86484-retrieving-windows-username/
Share on other sites

Thanks for the reply, however I have been trying to get LDAP and PHP working for sometime and have not managed it yet.

 

I should have mentioned the server this is running on is using IIS and is part of the same domain as the users.

 

I found this post on this site: http://www.phpfreaks.com/forums/index.php/topic,96892.0.html

 

Stating that he had made it work with: $_SERVER['REMOTE_USER']  but I tried echoing this info out and got nothing :(

 

Why would it work for him? do I need to upgrade php?

Is it using LDAP when it calls $_SERVER['REMOTE_USER'] ?

 

I thought that was a client side variable or something.

 

Forgive me if this is a stupid question as I am very new to all this, but all I want to capture is the login name of the person currently viewing the site.

 

I am thinking I should be updating PHP and IIS on the server anyway as I have just checked and my versions are:

 

PHP Version 4.4.2

IIS : Microsoft-IIS/5.0

 

So I will give those a go first and reply back, but would appreciate an  answer on my question above in the meantime if poss.

No you are referring to a super global when you use $_SERVER and in fact your referring to a non-existent super global as well because there is no such thing as $_SERVER['REMOTE_USER'] anyway :)

 

You need to use the LDAP functions in PHP in order to capture this information and even then you need to be sure its a domain user.

 

 

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.