parse_cookie example


    public function validate_cookie( $cookie = '' ) {

        if ( ! $cookie ) {
            if ( empty( $_COOKIE[ RECOVERY_MODE_COOKIE ] ) ) {
                return new WP_Error( 'no_cookie', __( 'No cookie present.' ) );
            }

            $cookie = $_COOKIE[ RECOVERY_MODE_COOKIE ];
        }

        $parts = $this->parse_cookie( $cookie );

        if ( is_wp_error( $parts ) ) {
            return $parts;
        }

        list( , $created_at$random$signature ) = $parts;

        if ( ! ctype_digit( $created_at ) ) {
            return new WP_Error( 'invalid_created_at', __( 'Invalid cookie format.' ) );
        }

        
Home | Imprint | This part of the site doesn't use cookies.