Jump to content

daveneil

New Members
  • Posts

    2
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

daveneil's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. Hi I am finding that I get a random LDAP search fail the initial time i run a script against 2008R2 when I refresh all is ok ? PHP 5.2.5 get the same thing with the latest version of PHP. any ideas ? its as if the DC is sleeping until you give it a nudge, running on 2008R2 running on vmware.
  2. this works for me : function get_members($group,$ldapuser,$ldappassword) { $ldap_host = "10.10.10.10"; $ldap_dn = "DC=domainname,DC=local"; $base_dn = "DC=domainname,DC=local"; $ldap = ldap_connect($ldap_host); ldap_set_option($ldap, LDAP_OPT_PROTOCOL_VERSION,3); ldap_set_option($ldap, LDAP_OPT_REFERRALS,0); ldap_bind($ldap, $ldapuser, $ldappassword) or die("Could not bind to server"); $results = ldap_search($ldap,$ldap_dn, "cn=" . $group); $member_list = ldap_get_entries($ldap, $results); $dirty = 0; $group_member_details = array(); foreach($member_list[0]['member'] as $member) { if($dirty == 0) { $dirty = 1; } else { $member_dn = explode_dn($member); $member_cn = str_replace("CN=","",$member_dn[0]); $member_search = ldap_search($ldap, $base_dn, "(CN=" . $member_cn . ")"); $member_details = ldap_get_entries($ldap, $member_search); $group_member_details[] = array($member_details[0]['givenname'][0],$member_details[0]['sn'][0],$member_details[0]['mail'][0],$member_details[0]['samaccountname'][0]); } } ldap_close($ldap); return $group_member_details; }
×
×
  • 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.