Jump to content

Recommended Posts

if you are on a windoze network

 

<?php
$domuser = $_SERVER['LOGON_USER'];                       //--> domain\username (or domain\\username)
list ($domain, $username) = explode ("\\", $domuser);
?>

 

With some versions you may need explode ("\\\\", $domuser)

Link to comment
https://forums.phpfreaks.com/topic/51574-get-weindows-login/#findComment-254007
Share on other sites

You should have  a look at this...

 

<?php
$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;
?>

 

Hope it helps.

Andy

Link to comment
https://forums.phpfreaks.com/topic/51574-get-weindows-login/#findComment-254581
Share on other sites

Hmm the WScript  worked but it gave me the wrong user name.

 

example:

I have a server on my network hosting this site which requires a login to associate some features with the individual that is using the site. I would like to be able to pull the user name of the person hitting the site so I can use that instead of having them go through a login page.

 

Any ideas??

 

Thanks

Link to comment
https://forums.phpfreaks.com/topic/51574-get-weindows-login/#findComment-254797
Share on other sites

Well I have two servers on is A windows box running IIS and it dose have anonymous login enabled(which I can't disable) and a Mac os x box with apache running. On the IIS box it dose not give me anything for that value. On the apache box it doesn't even show that variable. I will try it on yet another server when I get home.

 

 

 

Link to comment
https://forums.phpfreaks.com/topic/51574-get-weindows-login/#findComment-254827
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.