簡體   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