Jump to content

Problem with getting the username in Active Dirctory


Recommended Posts

Hi all

Good morning

 

I did connect to the Active Dirctroy using PHP

 

  $ldapHost = "ldap://XXX.com";

    $ldapPort = "389";

    $ldapUser ="XXX@XXX.com";

    $ldapPswd ="XXX";

 

    $ldapLink =ldap_connect($ldapHost, $ldapPort)

    or die("Can't establish LDAP connection");

 

 

    ldap_bind($ldapLink,$ldapUser,$ldapPswd)

    or die("Can't bind to server.");

 

it's working well but how can I print the username I mean since I'm connected with Active Dirctory I want any user who enter the webpage it will print his name that stored in Active Dirctory

 

thank you :)

Link to comment
Share on other sites

That is not possible.  You can pull information from AD via ldap but there is no magical association that will occur that tells you a particular user who is browsing a page is even logged in.  There is no intrinsic connection between the OS user and browser instance. 

Link to comment
Share on other sites

No.  An active directory user is a microsoft operating system specific function that exists at an entirely different network layer and protocol from the WWW.  There's a couple of techniques that *might* work for you in this thread:  http://stackoverflow.com/questions/168610/can-you-get-a-windows-ad-username-in-php

Link to comment
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.