Jump to content

PatPHP

Members
  • Posts

    30
  • Joined

  • Last visited

    Never

Posts posted by PatPHP

  1. Hi

     

    I reckon it is very simple but I didn't find any solution yet.

     

    How can I add more values with key to an array?

     

    $aReturn = array();

    $aReturn[] = array($aRow['id'] => $aRow['Type']);

     

    This adds arrays but then I have arrays in an array.

     

    Array should look like this:

    $aReturn[] = array("mist1" => "111", "mist2" => "222", "mist3" => "333");

     

    Now how can I add more value to this array? Please "Value" + "Key".

     

    Thx

  2. Hi

     

    I already tried out many different ways but I haven't found a solution yet. I want that my ldap query just filters or search in a group in my example called 'InternetAccess'. But it still give me the student even he is not in that group. It works fine on OUs but it fails on groups.... Somebody has an idea what could be the problem?

     

        //Connect
        $ad = ldap_connect("10.0.10.10");
    
        //Set some variables
        ldap_set_option($ad, LDAP_OPT_PROTOCOL_VERSION, 3);
        ldap_set_option($ad, LDAP_OPT_REFERRALS, 0);
    
        //Bind to the ldap directory
        $bd = ldap_bind($ad,"test@test.edu.au","password")
            or die("Couldn't bind to AD!");
    
        //Search the directory
        $result = ldap_search($ad, "OU=Students,OU=test,DC=test,DC=edu,DC=au", "CN=InternetAccess");
    
        //Create result set
        $entries = ldap_get_entries($ad, $result);
    
        //Sort and print
        echo "User count: " . $entries["count"] . "<br /><br /><b>Users:</b><br />";
    
        for ($i=0; $i < $entries["count"]; $i++)
        {
            echo $entries[$i]["displayname"][0]."<br />";
        }
    
        //never forget to unbind!
        ldap_unbind($ad);
    

     

    thx

    pat

×
×
  • 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.