|
Posted by Csaba Gabor on 08/18/23 11:53
sachu wrote:
> Hi Everyone,
> I want develop the intranet site with seamless authentication. Is there
> any way to capture only the user name who has logged in the windows
> machine.
> Iam using PHP 5.0 MySQL and IIS Server.
> I have tried with $_SERVER['LOGON_USER'] but its returning nothing.
> Please help me out.
This works for me under WinXP / Apache 2 (note that $nw->username is
not useful in this sense):
$nw = new COM("WScript.Network");
print "username0: " . $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;
Csaba Gabor from Vienna
[Back to original message]
|