$ldap_user_pattern = $_POST['userPattern']; $ldap_server = $_POST['ldapHost']; $ldap_port = $_POST['ldapPort']; $ldap_ssl_verify = $_POST['ldapSslVerify'] == 'true' ? true : false; $ldap_start_tls = $_POST['ldapStartTls'] == 'true' ? true : false; $ldap_bind_type = $_POST['bindType']; $ldap_bind_scope = $_POST['bindScope']; $ldap_password = isset($_POST['ldapPass']) && trim($_POST['ldapPass']) != '' ? $_POST['ldapPass'] : null; $ldap_username = isset($_POST['ldapUser']) && trim($_POST['ldapUser']) != '' ? $_POST['ldapUser'] : null; $auth = new Ldap(); $auth->setLdapAccountBase($ldap_account_base); $auth->setLdapAccountEmail($ldap_account_email); $auth->setLdapAccountFullname($ldap_account_full_name); $auth->setLdapBindType($ldap_bind_type); $auth->setLdapBindScope($ldap_bind_scope); $auth->setLdapPassword($ldap_password); $auth->setLdapUsername($ldap_username); $auth->setLdapPort($ldap_port); $auth->setLdapServer($ldap_server); $auth->setLdapSslVerify($ldap_ssl_verify); $auth->setLdapStartTls($ldap_start_tls); $auth->setLdapUserPattern($ldap_user_pattern); try { $username = $auth->getLdapUserAttribute(); $info = $auth->listAllUsers(array($auth->getLdapUserAttribute(), $ldap_account_full_name, $ldap_account_email), 0); if (is_array($info)) { for ($i = 0; $i < $info['count']; $i++) { $user = @$info[$i][$username][0]; echo '<tr>'; echo '<td><input type="checkbox" name="ldapAdminUser[]" value="' . $user . '" /></td>'; echo '<td>' . $user . '</td>';