function user_password($username,$password){
        if ($username==NULL){ return (false); }
        if ($password==NULL){ return (false); }
        if (!$this->_bind){ return (false); }
        if (!$this->_use_ssl){ echo ("FATAL: SSL must be configured on your webserver and enabled in the class to set passwords."); exit(); }
        
        $user=$this->user_info($username,array("cn"));
        if ($user[0]["dn"]==NULL){ return (false); }
        $user_dn=$user[0]["dn"];
                
        $add=array();
        $add["unicodePwd"][0]=$this->encode_password($password);
        
        $result=ldap_mod_replace($this->_conn,$user_dn,$add);
        if ($result==false){ return (false); }
        
        return (true);
    }
function user_password($username,$password){
        if ($username==NULL){ return (false); }
        if ($password==NULL){ return (false); }
        if (!$this->_bind){ return (false); }
        if (!$this->_use_ssl){ echo ("FATAL: SSL must be configured on your webserver and enabled in the class to set passwords."); exit(); }
        
        $user=$this->user_info($username,array("cn"));
        if ($user[0]["dn"]==NULL){ return (false); }
        $user_dn=$user[0]["dn"];
                
        $add=array();
        $add["unicodePwd"][0]=$this->encode_password($password);
        
        $result=ldap_mod_replace($this->_conn,$user_dn,$add);
        if ($result==false){ return (false); }
        
        return (true);
    }
function user_password ( $ username , $ password ) { if ( $ username == NULL ) { return ( false ) ; } if ( $ password == NULL ) { return ( false ) ; } if ( ! $ this -> _bind ) { return ( false ) ; } if ( ! $ this -> _use_ssl ) { echo ( "FATAL: SSL must be configured on your webserver and enabled in the class to set passwords." ) ; exit ( ) ; } $ user = $ this -> user_info ( $ username , array ( "cn" ) ) ; if ( $ user [ 0 ] [ "dn" ] == NULL ) { return ( false ) ; } $ user_dn = $ user [ 0 ] [ "dn" ] ; $ add = array ( ) ; $ add [ "unicodePwd" ] [ 0 ] = $ this -> encode_password ( $ password ) ; $ result = ldap_mod_replace ( $ this -> _conn , $ user_dn , $ add ) ; if ( $ result == false ) { return ( false ) ; } return ( true ) ; }
Set the password of a user
Set the password of a user