add some changes
[Snippets.git] / LDAP.class.php
index 32588abed83c30900841955c174bb639cc2f456c..8063760aedcb874e7b9d1ff456050342ac9fb2f0 100644 (file)
@@ -10,7 +10,7 @@ class LDAP {
         * LDAP resource id
         * @var object
         */
-       protected $ldap = Null; 
+       protected $ldap = null; 
        
        /**
         * LDAP DN
@@ -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;
                        }
                }