繁体   English   中英

在PHP中获取Intranet Windows用户名

[英]Get Intranet windows username in php

i can get the windows username in my system but i need to retrieve the windows username from **visitors**. 

访客的意思并不是互联网在说内联网

正在为此开发Intranet网站,我需要:

下面的代码供您参考:

/* to get the windows username */
$nw = new COM("WScript.Network");
print "username: " . $nw->username . "<br><br>";
$computername = $nw->computername;
print "computername: $computername<br>";
$owmi = new COM("winmgmts:\\\\$computername\\root\\cimv2");
$comp = $owmi->get("win32_computersystem.name='$computername'" );
print "username: " . $comp->username; echo "<br>";
/* to get the windows username */

根据您的php版本,使用$ _SERVER ['AUTH_USER']或$ _SERVER ['PHP_AUTH_USER'],其中之一应该有效。

在这里查看更多信息

请参阅此处获取基本身份验证

有关NTLM身份验证,请参见此处

暂无
暂无

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

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