Hi I have seen a lot of tutorials on how to do this but I still can’t get my head around it. I work in a school where we have an active directory system with ldap installed also but I can’t seem to get my hard around where it asks for things such as CN, OU, etc I understand what they mean but how they reference to our active directory remains a mystery. I suppose what I’m asking is for someone to show me a screen shot of a active directory and an example login that refers to the active directory screen shot.
You should be able to get the AD info from whoever is administering the network.
I suggest you look into using a library, you can find several on github/packagist. PHP does have support for ldap but it doesn’t hurt with a layer on top to make it a bit more sensible.
example lib
For an introduction you can read over this
LDAP Term Description
dn A dn, or Distinguished Name, is a record’s unique identifier. This is much like a primary key in a relational database.
Directory Schema (or just Schema) In an LDAP directory, the entry values are governed by a directory schema. A directory schema is a set of definitions and constraints concerning the structure of the directory information.
entry An entry is much like a record in a database, and contains attributes which store the data for the entry.
attribute An attribute is much like an element in an associative array or column in a database. It specifies the type of information which can be stored for that attribute, along with other criteria, such as sorting and searching rules, case-sensitivity and so on.
cn cn is short for common name. An example would be “John Smith”
sn sn is short for surname.
I’ve got access to the ad but not sure what part is what lol
ok to help me out for the code example below using the image provided what would the correct info?
// Active Directory server
$ldap_host = “192.168.128.28”; //ip of server with ad i know this part
// Active Directory DN
$ldap_dn = "OU=?-----?,DC=?-----?,DC=?-----?,DC=?-----?";//does dc have to have 3 parts
// Active Directory user group
$ldap_user_group = "?-----?";
// Active Directory manager group
$ldap_manager_group = "?-----?";
// Domain, for purposes of constructing $user
$ldap_usr_dom = '@?-----?';
Please help