This may sound kludgy. Probably is. Since it's an internal site, you can
control things a bit. The Windows Scripting Host (installed on Win 98+ and
Win2K+, available for others as download) exposes at least the username as a
property on a WScript.Network object. However, since access to that object
is outside the security of a browser, you can't use client-side code to grab
it while in a browser. You COULD create an HTA(HTML Application. Just rename
an HTML file to *.hta on an IE enabled file and double click it) file to
distribute to your users that they use as an interface to your app instead
of the browser. That lets Javascript or VBScript access the WScript.Network
object and you can grab the username and at least prefill the logon box. The
password isn't exposed as a part of the object and sites with info to grab
it are filtered under "Criminal Skills" I can't help on that one. Here's the
Javascript to put in an HTA file to pull out the user information (among
other info).

var WshNetwork = new ActiveXObject("WScript.Network");
   var oDrives = WshNetwork.EnumNetworkDrives();
   var oPrinters = WshNetwork.EnumPrinterConnections();
   WScript.Echo("Domain = " + WshNetwork.UserDomain);
   WScript.Echo("Computer Name = " + WshNetwork.ComputerName);
   WScript.Echo("User Name = " + WshNetwork.UserName);
   WScript.Echo("Network drive mappings:");
   for(i=0; i<oDrives.Count(); i+=2){
      WScript.Echo("Drive " + oDrives.Item(i) + " = " + oDrives.Item(i+1));
   WScript.Echo("Network printer mappings:");
   for(i=0; i<oPrinters.Count(); i+=2){
   WScript.Echo("Port " + oPrinters.Item(i) + " = " + oPrinters.Item(i+1));

"Jack" <[EMAIL PROTECTED]> wrote in message
> Dear all
> Is there any ways that i can pass the Windows Logon Username to PHP?
> Any Built in Function that can handle this? cause i don't want the user to
> logon so many times and my website is for internal only!
> Thx
> Jack

PHP General Mailing List (
To unsubscribe, visit:

Reply via email to