title: Checking for group membership in Active Directory using LDAP and PHP
body: <p>I am pretty new to LDAP and Active Directory, and I think this should be a simple question. I am connecting to AD using the following code:</p>
  
  <pre><code>$ad = ldap_connect("domain.com") or die("Could not connect to AD");
  //bind to the server
  $uname = $uid . "@domain.com";
  if (!ldap_bind($ad, "$uname", "$pwd") and $uid != "guest") {
      code...
  }
  </code></pre>
  
  <p>and I need to check to see if the user is a member of one of three groups: ECSDocket_Admin, ECSDocket_User, or ECSDocket_Viewer. I have been searching around and most of the answers I have found use CN= and DN= and DC= in their queries, but I don't know what those mean. If someone could explain how it works, and what I need to do to figure out the group membership, that would be awesome!  </p>