INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Member Login

HANDLE


PASSWORD
Remember Me
Forgot Password?

Come Join Us!

  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

E-mail*
Handle

Password
Verify P'word
*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Partner With Us!

"Best Of Breed" Forums Add Stickiness To Your Site
Partner Button
(Download This Button Today!)

Member Feedback

"...I wish I knew about this site years ago. It would have saved me a lot of heartaches..."

Geography

Where in the world do Tek-Tips members come from?
GigaG (TechnicalUser)
7 Apr 08 9:27
Below is my config. I am connecting through php to AD LDAP server for authentication. the ldap part works like a dream. I used the explode function to drop all the excess baggage with the user to only get me the display name, but I am unable to turn this into an array or some other way to sort the info. I know explode is suppose to make the variable an array, but i think because i'm in a loop, it is erasing the data


<?

/******globals needed for included pages***/

global $displayname;
//$user =& JFactory::getUser();

/*************Ens of globals needed for included pages***/


    $dn = "CN=Sales_Managers,OU=CINET,OU=Carousel Everyone,DC=CHARLESTOWN,DC=CAROUSELINDUSTRIES,DC=com";

    $attributes = array("displayname","member", "1");

    $filter = "(cn=*)";

    $ad = ldap_connect("10.0.25.250")
          or die("Couldn't connect to AD!");
  
    ldap_set_option($ad, LDAP_OPT_PROTOCOL_VERSION, 3);
    ldap_set_option($ad, LDAP_OPT_SIZELIMIT, 500);

    $bd = ldap_bind($ad,"administrator@charlestown.carouselindustries.com","c@r0us3L")
          or die("Couldn't bind to AD!");

    $result = ldap_search($ad, $dn, $filter, $attributes);

    $entries = ldap_get_entries($ad, $result);

// Specify Variable and begin
    $a=0;
    
    //Create your loop for $a
    do
    {
    
    //Grab all the Members array of the user logged in and store
   $member=$entries[0]["member"][$a];
        
        
    //$member=$entries[0]["member"][0];
    // Explode $members to grab only the CN name
    $member1=explode ("CN=",$member);
    $member2=explode (",",$member1[1])

    //echo $member . "<br>";
    //echo $member1[1] . "<br>";
    $members3[$a]=array($members2[0]);
    //echo $members3;
    echo $member2[0] . "<br>";
    print_r ($members3);
    echo $a;
    $a++;
}
while($a<50);
     ldap_unbind($ad);
     ?>

MCP ACA-I CTP

GigaG (TechnicalUser)
7 Apr 08 9:55
I also would like to add tat i did a print_r($member2); and got this....

Array ( [0] => Gregg Coleman [1] => OU=ALB Users [2] => OU=ALB Office [3] => OU=Carousel Everyone [4] => DC=CHARLESTOWN [5] => DC=CAROUSELINDUSTRIES [6] => DC=com )

Array ( [0] => Chris Jenkins [1] => OU=ALB Users [2] => OU=ALB Office [3] => OU=Carousel Everyone [4] => DC=CHARLESTOWN [5] => DC=CAROUSELINDUSTRIES [6] => DC=com )

Ultamitly, I would like to take the names which are Array[0] and put them in an array for sorting so that I put them in a dropdown box

Thanks

MCP ACA-I CTP

Start A New Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members!

Promoting, selling, recruiting and student posting
are not allowed in the forums.
Posting Policies

LINK TO THIS FORUM!
(Add Stickiness To Your Site By Linking To This Professionally Managed Technical Forum)
TITLE: PHP Forum at Tek-Tips
URL: http://www.tek-tips.com/threadminder.cfm?pid=434
DESCRIPTION: PHP technical support forum and mutual help system for computer professionals. Selling and recruiting forbidden.

 

Back To Forum