Hi !!!
first, i want to apologize for my english !!! LOL
Oki, i try to create a php interface to manage a Win2k Active Directory server.
I would like to create a user account but I have some troubles.
I know I can do it with PHP LDAP functions, but when I try, the created account is Disable !!!
Moreover, i would like to know how to set the user password !!!
I need help !!!
Here a part of my code :
$ds=ldap_connect("myserver");
if ($ds) {
$dn ="cn=administrateur,cn=Users, DC=mydomain,dc=local";
$pwd ="adm_pwd";
$r=ldap_bind($ds,$dn,$pwd);
$info["cn"]="Bob";
$info["objectclass"]="user" ;
$info["samaccountname"]="bob";
$info["sn"]="bob";
$info["mail"]="bob3@somewhere.fr";
$info["userpassword"]="azerty";
$info["userprincipalname"]="bob3@mydomain.local";
$r=ldap_add($ds, "cn=bob, cn=users,dc=mydomain, dc=local", $info);
ldap_close($ds);
} else {
echo "Impossible de se connecter au serveur LDAP ";
}
PHP LDAP and Acitve Directory
Moderator: General Moderators
I dont know that much about MS AD, but it sounds like new accounts are disabled by default when created... Query that new account you just created and see all the attributes it has, might be useful, heritance is sometimes tricky. Also compare a user object that you have created and one that has been created with ms supplied tool (Query both from php). Any differences?
You can do like:
And you see all the data that the query returned...
Hope that helps
-9902468
You can do like:
Code: Select all
$user_data_result = ldap_search($ldapConnection, "user_context", "user_dn");
$user_data_array = ldap_get_entries($ldapConnection, $user_data_result);
echo "<pre>";
print_r($user_data_array);
echo "</pre>";Hope that helps
-9902468
Check the Active DirectoryServer Configuration
http://www.dit.gov.bt/~takeshi/material ... index.html
Sachin Junghare
________________________
http://www.dit.gov.bt/~takeshi/material ... index.html
Sachin Junghare
________________________
Followup ..
Just wondering if anyone knows of a good resource on active directory attribute names and what not, to use within the php ldap queries.
IE: can you set passwrod using ldap, or is it 100% kerberose.
how can set there disabled flag on or off?
(note: disabling using ADSI is freakin simple)
What are the various attributes names for a user object?
IE: can you set passwrod using ldap, or is it 100% kerberose.
how can set there disabled flag on or off?
(note: disabling using ADSI is freakin simple)
What are the various attributes names for a user object?