简体   繁体   English

在php的Intranet上获取客户端Windows登录用户名

[英]get client windows login username on intranet in php

I am trying to get the clients username from server which in on the intranet. 我正在尝试从Intranet上的服务器获取客户端用户名。 Im using mozilla firefox and chrome only. 我只使用mozilla firefox和chrome。 I am able to get the information like Client PC Name and Client Pc IP. 我可以获得诸如“客户端PC名称”和“客户端PC IP”之类的信息。 How can i get the username for the client who access the website on intranet. 我如何获取访问Intranet网站的客户端的用户名。

The code i am using is below 我正在使用的代码如下

<?php
    $compt = gethostbyaddr($_SERVER['REMOTE_ADDR']);
     // i get complete pc name like example: abbc123.abc.google.com
    $compt_name = $issued_for = strtok($compt,'.');
    //i get the pc name abbc123
    echo $compt_name;
    ?>

how can i use the computer name to get the username? 如何使用计算机名称获取用户名? i have tried searching but cant find anything that will work. 我曾尝试搜索,但找不到任何可行的方法。 im using PHP and all answers i get is for c# , Vb etc. The server is running windows server 2012 我使用PHP,我得到的所有答案都是针对C#,Vb等的。服务器正在运行Windows Server 2012

It is because C# and VB are desktop applications and can access system's username. 这是因为C#和VB是桌面应用程序,并且可以访问系统的用户名。 PHP, however, is a web application that can not access system resources beyond the purview of a web browser. 但是,PHP是一个Web应用程序,无法访问超出Web浏览器权限的系统资源。

What you can do, however, is use a java application to fetch the user name from a computer and pass it to PHP. 但是,您可以使用Java应用程序从计算机中获取用户名并将其传递给PHP。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM