PMF_Ldap::error PHP Method

error() public method

Returns the LDAP error message of the last LDAP command
public error ( resource $ds = null ) : string
$ds resource LDAP resource
return string
    public function error($ds = null)
    {
        if ($ds === null) {
            $ds = $this->ds;
        }
        return ldap_error($ds);
    }

Usage Example

Example #1
0
     if (is_null($ldap_password)) {
         print "<p class=\"error\"><strong>Error:</strong> There's no LDAP password input.</p>\n";
         HTMLFooter();
         die;
     }
     $ldap_base = PMF_Filter::filterInput(INPUT_POST, 'ldap_base', FILTER_SANITIZE_STRING);
     if (is_null($ldap_base)) {
         print "<p class=\"error\"><strong>Error:</strong> There's no distinguished name input for LDAP.</p>\n";
         HTMLFooter();
         die;
     }
     // check LDAP connection
     require PMF_ROOT_DIR . "/inc/Ldap.php";
     $ldap = new PMF_Ldap($ldap_server, $ldap_port, $ldap_base, $ldap_user, $ldap_password);
     if (!$ldap) {
         print "<p class=\"error\"><strong>LDAP Error:</strong> " . $ldap->error() . "</p>\n";
         HTMLFooter();
         die;
     }
 }
 // check user entries
 $password = PMF_Filter::filterInput(INPUT_POST, 'password', FILTER_SANITIZE_STRING);
 if (is_null($password)) {
     print "<p class=\"error\"><strong>Error:</strong> There's no password for the administrator's account. Please set your password.</p>\n";
     HTMLFooter();
     die;
 }
 $password_retyped = PMF_Filter::filterInput(INPUT_POST, 'password_retyped', FILTER_SANITIZE_STRING);
 if (is_null($password_retyped)) {
     print "<p class=\"error\"><strong>Error:</strong> There's no retyped password. Please set your retyped password.</p>\n";
     HTMLFooter();
All Usage Examples Of PMF_Ldap::error