Вот таким способом можно реализовать получение имени пользователя Windows средствами PHP. Для корректной работы кода в вам нужно будет сконфигурированный Apache.
*************************************************************** * PHP NTLM GET LOGIN * Version 0.2 * ==================================================== * * Copyright (c) 2004 Nicolas GOLLET (Nicolas.gollet@secusquad.com) * Copyright (c) 2004 Flextronics Saint-Etienne * * This program is free software. You can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License. * ***********************************************************************/ $headers = apache_request_headers(); if($headers['Authorization'] == NULL){ header( "HTTP/1.0 401 Unauthorized" ); header( "WWW-Authenticate: NTLM" ); exit; }; if(isset($headers['Authorization'])) { if(substr($headers['Authorization'],0,5) == 'NTLM '){ $chaine=$headers['Authorization']; $chaine=substr($chaine, 5); $chained64=base64_decode($chaine); if(ord($chained64{8}) == 1){ if (ord($chained64[13]) != 178){ echo "Please IE"; exit; } $retAuth = "NTLMSSP"; $retAuth .= chr(0); $retAuth .= chr(2); $retAuth .= chr(0); $retAuth .= chr(0); $retAuth .= chr(0); $retAuth .= chr(0); $retAuth .= chr(0); $retAuth .= chr(0); $retAuth .= chr(0); $retAuth .= chr(40); $retAuth .= chr(0); $retAuth .= chr(0); $retAuth .= chr(0); $retAuth .= chr(1); $retAuth .= chr(130); $retAuth .= chr(0); $retAuth .= chr(0); $retAuth .= chr(0); $retAuth .= chr(2); $retAuth .= chr(2); $retAuth .= chr(2); $retAuth .= chr(0); $retAuth .= chr(0); $retAuth .= chr(0); $retAuth .= chr(0); $retAuth .= chr(0); $retAuth .= chr(0); $retAuth .= chr(0); $retAuth .= chr(0); $retAuth .= chr(0); $retAuth .= chr(0); $retAuth .= chr(0); $retAuth .= chr(0); $retAuth64 =base64_encode($retAuth); $retAuth64 = trim($retAuth64); header( "HTTP/1.0 401 Unauthorized" ); header( "WWW-Authenticate: NTLM $retAuth64" ); exit; } else if(ord($chained64{8}) == 3){ $lenght_domain = (ord($chained64[31])*256 + ord($chained64[30])); $offset_domain = (ord($chained64[33])*256 + ord($chained64[32])); $domain = substr($chained64, $offset_domain, $lenght_domain); $lenght_login = (ord($chained64[39])*256 + ord($chained64[38])); $offset_login = (ord($chained64[41])*256 + ord($chained64[40])); $login = substr($chained64, $offset_login, $lenght_login); $lenght_host = (ord($chained64[47])*256 + ord($chained64[46])); $offset_host = (ord($chained64[49])*256 + ord($chained64[48])); $host = substr($chained64, $offset_host, $lenght_host); $hostinfo = $host; } } } /* * Обработка полученных значений * http://www.maiboroda.ru */ // Обработка полученого логина с сервера $strLogin =''; for($i=0;$i<strlen($login);$i++) { if(ord($login[$i])!="0x00") $strLogin.=$login[$i]; } // Обработка имени компьютера полученного с сервера $strHost =''; for($i=0;$i<strlen($hostinfo);$i++) { if(ord($hostinfo[$i])!="0x00") $strHost.=$hostinfo[$i]; }