Im working on a page, that contains, the modifications of a database ( have a webpage, where you can modify the database and this is a history database of the modifications which contains when, what have been modified). On this page/ in this database I have to store that who modified it. And my quetion is that how can I get the windows user name. Im working on apache server mysql db and in php and i have to get only windows users.
Asked
Active
Viewed 195 times
0
-
where is you code? – Aman Maurya Aug 11 '16 at 07:50
-
Paste your code first – Passionate Coder Aug 11 '16 at 07:52
-
Normal webpage or company intranet? In other words is there an active directory you could use? – hYg-Cain Aug 11 '16 at 07:53
-
I think we have active directory. – Daniel Aug 11 '16 at 08:01
-
If you have active directory then you should be able to use ldap queries to get whatever information you want from AD – Professor Abronsius Aug 11 '16 at 08:05
-
1See this: http://stackoverflow.com/questions/30070058/ntlm-authentication-get-windows-login-domain-and-host-in-php – some1 Aug 11 '16 at 08:07
-
I dont really have code about this, I tried sg, but it doesnt really work – Daniel Aug 11 '16 at 08:08
-
Thanks some1, I'll check it. – Daniel Aug 11 '16 at 08:12
-
I didnt really config mod_auth_sspi, but in th httpd.conf file I found a mod_authz_user without #. It should show me $_Server["PHP_AUTH_USER"] or sgh like this? – Daniel Aug 11 '16 at 08:53
-
It depends at a minimum on how PHP and Apache are configured, and what sort of authentication you're using. – Harry Johnston Aug 12 '16 at 01:49
1 Answers
0
I tried this on my laptop:
cmd> php -r "exec('echo %username%', $output); var_dump($output);"
array(1) {
[0] =>
string(7) "jigar.d"
}
And if you want username along with computer name:
cmd> php -r "exec('echo %username%@%computername%', $output); var_dump($output);"
array(1) {
[0] =>
string(20) "jigar.d@****JIGARD"
}
Not sure if this is what you are looking for.
For authentication of intranet PHP based applications we use PHP LDAP to connect and authenticate users.
Note: My laptop is on AD as well. I have * my actual computername.
Jigar
- 3,256
- 1
- 30
- 51
-
Thanks its do sgh, but im sure that it isnt my user name what it gaves back. I think its maybe the name of the virtual server were it runs. – Daniel Aug 11 '16 at 09:24