Ldap::delete($connection, 'jan.modaal', $dc); Ldap::delete($connection, 'zhang.san', $dc); Ldap::delete($connection, 'johnny.doe', "ou=Users,{$dc}"); Ldap::delete($connection, 'hans.mustermann', $dc); Ldap::delete($connection, 'Ruşinică Piţigoi', $dc); Ldap::deleteGroup($connection, 'Users', $dc); Ldap::addGroup($connection, 'Users', $dc); Ldap::add($connection, 'john.doe', '{CRYPT}' . crypt('foobar'), $dc); Ldap::add($connection, 'jan.modaal', '{SHA}' . base64_encode(pack('H*', sha1('qwerty'))), $dc); Ldap::add($connection, 'zhang.san', '{MD5}' . base64_encode(pack('H*', md5('asdfgh'))), $dc); Ldap::add($connection, 'johnny.doe', '{MD5}' . base64_encode(pack('H*', md5('12345'))), "ou=Users,{$dc}", array('displayName' => 'Johnny Doe', 'ou' => array('Users'))); //Ldap::add( $connection, 'jan.modaal', '{SHA}' . base64_encode( sha1( 'qwerty' ) ), $dc ); //Ldap::add( $connection, 'zhang.san', '{MD5}' . base64_encode( md5( 'asdfgh' ) ), $dc ); Ldap::add($connection, 'hans.mustermann', 'abcdef', $dc); Ldap::add($connection, 'Ruşinică Piţigoi', '12345', $dc); Ldap::fetchAll($connection, $dc); Ldap::close($connection); /** * Support for LDAP functions connect, add, delete and get_entries. */ class Ldap { /** * Connects to an LDAP server specified by $uri, with admin $user and $password. * * Returns a resource which can be used in LDAP functions like add, delete, search. * * @param string $uri Uri for LDAP, such as 'ldap://example.com' * @param string $format Format for an entry, like 'cn=%s,dc=example,dc=com'. %s is a literal placeholder for username * @param string $user Admin username * @param string $password Password for admin