dmccabe Posted January 17, 2008 Share Posted January 17, 2008 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? Quote Link to comment https://forums.phpfreaks.com/topic/86484-retrieving-windows-username/ Share on other sites More sharing options...
revraz Posted January 17, 2008 Share Posted January 17, 2008 Not sure how you can capture that, but try searching LDAP and PHP. Quote Link to comment https://forums.phpfreaks.com/topic/86484-retrieving-windows-username/#findComment-441922 Share on other sites More sharing options...
dmccabe Posted January 17, 2008 Author Share Posted January 17, 2008 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? Quote Link to comment https://forums.phpfreaks.com/topic/86484-retrieving-windows-username/#findComment-441941 Share on other sites More sharing options...
dmccabe Posted January 18, 2008 Author Share Posted January 18, 2008 Shameless bump? Quote Link to comment https://forums.phpfreaks.com/topic/86484-retrieving-windows-username/#findComment-442608 Share on other sites More sharing options...
Cep Posted January 18, 2008 Share Posted January 18, 2008 I know this may be an obvious thing to point out but have you actually enabled LDAP functions in your PHP.ini and then set the dlls in the Windows path variable? Quote Link to comment https://forums.phpfreaks.com/topic/86484-retrieving-windows-username/#findComment-442609 Share on other sites More sharing options...
dmccabe Posted January 18, 2008 Author Share Posted January 18, 2008 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. Quote Link to comment https://forums.phpfreaks.com/topic/86484-retrieving-windows-username/#findComment-442630 Share on other sites More sharing options...
Cep Posted January 21, 2008 Share Posted January 21, 2008 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. Quote Link to comment https://forums.phpfreaks.com/topic/86484-retrieving-windows-username/#findComment-445210 Share on other sites More sharing options...
resago Posted January 21, 2008 Share Posted January 21, 2008 you have to tell IE to send intranet login, you have to then configure IIS for authentication with using AD. then the server variable will contain the info. Quote Link to comment https://forums.phpfreaks.com/topic/86484-retrieving-windows-username/#findComment-445218 Share on other sites More sharing options...
Cep Posted January 21, 2008 Share Posted January 21, 2008 I just checked that, I stand corrected $_SERVER['REMOTE_USER'] does exist (just can't see it in the PHP docs.) Quote Link to comment https://forums.phpfreaks.com/topic/86484-retrieving-windows-username/#findComment-445268 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.