Developed a small project on the intranet of php. Powered by apache. You need to know which AD user made the submit form. How to make the variable $ _SERVER ['auth_user'] get the name of the logged in user?

In general, both options offered here are not rolled out ... :( In the first case, because the server is running on Linux, vbscript does not roll. The second option is to access LDAP. Here you will most likely not be able to get the login user name, because LDAP in theory, this is simply not intended. See the comments below http://serverfault.com/questions/180918/find-users-currently-logged-in-using-ldap

Instead, you can configure apache authorization in AD via LDAP. Then the domain user name gets into the PHP_AUTH_USER variable. The truth here is also a nuance. Currently, only opaque basic authorization is implemented (the simplest option), i.e. with login and password. How will it be with transparent - it is not yet clear ...

  • and how did you do? - des1roer

1 answer 1

Strange desire :) is there to get it?

The fact is that there is PHP_AUTH_USER , into which the username falls on HTTP basic auth , and there is AUTH_USER , into which anything can go (no standard is defined), up to the user running the web server, not necessarily the name from AD .

So you need to directly ask for your LDAP username, for example. Or here's an example of how to do it through NetBIOS.

  • So we have already tried :) did not roll ... the code took one to one (maybe it was not worth it to do this). In principle, no matter where to get this data .. the main thing is that the user does not have to enter a login / password, but the script knew who pressed the button ... - ieg
  • Directly this code was not worth it, there is an indistinct receipt of an IP address and a self-made knee-length query on NetBIOS. I would try through LDAP. <br/> <br/> Another option. If you have such a direct intranet that everyone is sitting under Windows and under the explorer, then you can try to get the name on the client, something like this: var wsn = new ActiveXObject ("WScript.Network"); var user_name = wsn.UserName; and then pass it to the script in the form field. - Ali
  • Through LDAP I suppose more correctly. Although our intranet is exactly under Windows with an explorer .. I understand that now you need to learn how to use LDAP in php? - ieg
  • But the question is similar. With solutions: < a href= " techques.com/question/1-5327104/… ... Ali