admin管理员组

文章数量:1123948

Can you explain to me what the following line of code means?

if ( isset( $_COOKIE[ $rp_cookie ] ) && 0 < strpos( $_COOKIE[ $rp_cookie ], ':' ) ) {

This is because I see that this is where my code finds the hitch and fails to set the password correctly.

UPDATE:

It is normal that once the e-mail has been sent to the page, the following selection puts False and then ends up at $ user = false; ?

if ( isset( $_COOKIE[ $rp_cookie ] ) && 0 < strpos( $_COOKIE[ $rp_cookie ], ':' ) ) {

if ( isset( $_COOKIE[ $rp_cookie ] ) && 0 < strpos( $_COOKIE[ $rp_cookie ], ':' ) ) {
    list( $rp_login, $rp_key ) = explode( ':', wp_unslash( $_COOKIE[ $rp_cookie ] ), 2 );
    $user                      = check_password_reset_key( $rp_key, $rp_login );
    if ( isset( $_POST['pass1'] ) && ! hash_equals( $rp_key, $_POST['rp_key'] ) ) {
        $user = false;
    }
} else {
    $user = false;
}

if ( ! $user || is_wp_error( $user ) ) {
    setcookie( $rp_cookie, ' ', time() - YEAR_IN_SECONDS, $rp_path, COOKIE_DOMAIN, is_ssl(), true );
    if ( $user && $user->get_error_code() === 'expired_key' ) {
        wp_redirect( site_url( 'prova/?action=lostpassword&error=expiredkey' ) );
    } else {
        wp_redirect( site_url( 'prova/?action=lostpassword&error=invalidkey' ) );
    }
    exit;
}

Thanks a lot to those who will help me.

Can you explain to me what the following line of code means?

if ( isset( $_COOKIE[ $rp_cookie ] ) && 0 < strpos( $_COOKIE[ $rp_cookie ], ':' ) ) {

This is because I see that this is where my code finds the hitch and fails to set the password correctly.

UPDATE:

It is normal that once the e-mail has been sent to the page, the following selection puts False and then ends up at $ user = false; ?

if ( isset( $_COOKIE[ $rp_cookie ] ) && 0 < strpos( $_COOKIE[ $rp_cookie ], ':' ) ) {

if ( isset( $_COOKIE[ $rp_cookie ] ) && 0 < strpos( $_COOKIE[ $rp_cookie ], ':' ) ) {
    list( $rp_login, $rp_key ) = explode( ':', wp_unslash( $_COOKIE[ $rp_cookie ] ), 2 );
    $user                      = check_password_reset_key( $rp_key, $rp_login );
    if ( isset( $_POST['pass1'] ) && ! hash_equals( $rp_key, $_POST['rp_key'] ) ) {
        $user = false;
    }
} else {
    $user = false;
}

if ( ! $user || is_wp_error( $user ) ) {
    setcookie( $rp_cookie, ' ', time() - YEAR_IN_SECONDS, $rp_path, COOKIE_DOMAIN, is_ssl(), true );
    if ( $user && $user->get_error_code() === 'expired_key' ) {
        wp_redirect( site_url( 'prova/?action=lostpassword&error=expiredkey' ) );
    } else {
        wp_redirect( site_url( 'prova/?action=lostpassword&error=invalidkey' ) );
    }
    exit;
}

Thanks a lot to those who will help me.

Share Improve this question edited Sep 3, 2019 at 8:39 Matteo Feduzi asked Sep 3, 2019 at 7:14 Matteo FeduziMatteo Feduzi 299 bronze badges
Add a comment  | 

1 Answer 1

Reset to default 0

If the cookie named $rp_cookie exists and if the colon character (:) in the cookie is not the first character, then…

本文标签: user accessI can39t recover my password