update ldap class
[Snippets.git] / LDAP.class.php
index 32588abed83c30900841955c174bb639cc2f456c..491e260d61e9b2b0f7b142dfe1547c425a6b4164 100644 (file)
@@ -71,10 +71,11 @@ class LDAP {
                $user['uidNumber'] = '5001';
                $user['loginShell'] = '/bin/bash';
                $user['mail'] = 'test@user.com';
-               $user['userPassword'] = '';
+               $user['userPassword'] = ''; // use ldap hash class to generate a password
+               or see here: http://techiesf1.blogspot.de/2012/03/add-ldap-user-from-php.html
                */
                if (is_array($user) && !empty($user)) {
-                       if (ldap_add($this->ldap, $this->dn, $user) {
+                       if (ldap_add($this->ldap, "uid=".$user['uid'].",".$this->dn, $user) {
                                return true;
                        }
                }