PHP 7 - User logged in (AD) and machine name

2

I've already researched Stackoverflow En and , google and only found things like getenv() , $_SERVER['user'] , shell_exec() or anything that returns me data Web server, no user logged into the system.

Another solution, nothing feasible, was to use ActiveX , which would only work in IE, with no chance.

The solution so far that I found was to create a Webservice in .Net, which only returns me the local user, nothing too difficult, but annoying to have to use another app besides the default in php, on another server .

As for the machine name, I already have ip local via $_SERVER , but I need the name of the local machine even running the dig with shell_exec does not roll.

Then, from the 2 questions, search the user (ad) for PHP I imagine that I really have no way out, but what about fetching the local machine name?

    
asked by anonymous 03.08.2017 / 21:58

1 answer

0

Try to do this by executing the following command.

<?php
$hostname = gethostbyaddr($_SERVER['REMOTE_ADDR']);
echo $hostname;
?>

Testing it aquifuncionou perfectly, by understanding what I understood what you want

Font

    
03.08.2017 / 22:01