0

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.

Daniel
  • 33
  • 1
  • 8

1 Answers1

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