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
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?

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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.

 

 

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.