titos97 0 Newbie Poster

On the Ad there is 2 security groups

  1. SG-warehouse1 users : test1
  2. SG-warehouse2 users : test2

These 2 Security groups belogs to one distubution list : DL-warehouse

what i am trying to do instead of searching 2 secuirty gorups i like to check if the user links to DL-warehouse then redirect the user . But when i vardump its does'nt show distrubution list : DL-warehouse

<?php


// using ldap bind
$ldaprdn  = 'test-AU\test1';     // ldap rdn or dn
$ldappass = 'Test01';  // associated password

$ldaptree    = ("OU=Users,OU=citrix,DC=testdc,DC=com,DC=au ");

// connect to ldap server
$ldapconn = ldap_connect("10.x.x.x")
    or die("Could not connect to LDAP server.");

if ($ldapconn) {

    // binding to ldap server
    $ldapbind = ldap_bind($ldapconn, $ldaprdn, $ldappass);

    // verify binding
    if ($ldapbind) {




 $result = ldap_search($ldapconn,$ldaptree, "(cn=*)") or die ("Error in search query: ".ldap_error($ldapconn));

        $data = ldap_get_entries($ldapconn, $result);

        // SHOW ALL DATA
        echo '<h1>Dump all data</h1><pre>';
      print_r($data);   
        echo '</pre>';


        // iterate over array and print data for each entry
        echo '<h1>Show me the users</h1>';
        for ($i=0; $i<$data["count"]; $i++) {
            echo "dn is: ". $data[$i]["dn"] ."<br />";

                $_SESSION['memberof'] =  $data[$i]["memberof"][0] ;

              echo   $_SESSION['memberof']."<br />" ;
              echo '<br/>';

        }
        // print number of entries found
        echo "Number of entries found: " . ldap_count_entries($ldapconn, $result);
    } else {
        echo "LDAP bind failed...";
    }

}

ldap_errno($ldapconn);
ldap_close($ldapconn);

?>