I'm using the following code to extract the username running on the windows machine:
[start code] $api = new win32; $api->registerfunction("long GetUserName (string &a, int &b) From advapi32.dll"); $len = 255; $name = str_repeat("\0", $len); if ($api->GetUserName($name, $len) == 0) { die("failed"); } [end code]
However when I 'echo ($name);' I get the value SYSTEM. This is correct, because advapi32.dll is probably being run by SYSTEM user on windows. However I need to get the name of the person logged onto the computer, not the SYSTEM running processes in the background. Is there any way of doing this?
Try $_SERVER['LOGON_USER']. With IIS, you will need to disable anonymous access.
-- ---John Holmes...
Amazon Wishlist: www.amazon.com/o/registry/3BEXC84AB3A5E/
php|architect: The Magazine for PHP Professionals – www.phparch.com
-- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php