Check your WordPress hash password with a simple password

I am creating an external application for which user credentials will be taken from the user table of the WordPress site database

WordPress uses PHPass hashing, I cannot verify the username and password for my external application, because the password in the database table 'users'hashed

I am trying to verify a simple password with a hashed password using a function wp_check_password, but I did not work, nothing was written with this code

<?php

$password = '965521425';
$hash = '$P$9jWFhEPMfI.KPByiNO9IyUzSTG7EZK0';

require_once('/home/nhtsoft/public_html/project/wp-includes/class-phpass.php');

function wp_check_password($password, $hash) {
    global $wp_hasher;

    if ( empty($wp_hasher) ) {
        $wp_hasher = new PasswordHash(8, true);
    }
    $check = $wp_hasher->CheckPassword($password, $hash);
    return apply_filters('check_password', $check, $password, $hash);
}    
?>

this code gives me a blank page.

How do I verify this password so that I can use these WordPress credentials to enter the app’s look?

+4
6

, - 965521425 - $P $BmI5G.LOoEx1iH.naNqVhWnSh5sMp31, :

require_once($_SERVER['DOCUMENT_ROOT']."/wp-load.php");
 $password = '965521425';
 $hash = '$P$BmI5G.LOoEx1iH.naNqVhWnSh5sMp31';
 var_dump(wp_check_password($password, $hash));

exit;
+3

<?php wp_check_password( $password, $hash, $user_id ) ?> Refer

+1

wp , , wp_check_password, - . php ( "? > " ) .

echo (wp_check_password($password, $hash) ? 'TRUE' : 'FALSE');

, .

+1
                $password_hashed = '$P$Bgf2Hpr5pOVOYAvQZUhUZeLIi/QuPr1';
                $plain_password = '123456';
                if ((wp_check_password($plain_password, $password_hashed)) == 1) {
                    echo "YES, Matched";
                } else {
                    echo "No, Wrong Password";
                }
0

...

require_once( ABSPATH . WPINC . '/class-phpass.php');
$wp_hasher = new PasswordHash(8, TRUE);
$plain_password     = trim($_POST['pass_current']); //user type password
$user               = get_user_by('id', get_current_user_id());
$password_hashed    =  $user->user_pass;

if($wp_hasher->CheckPassword($plain_password, $password_hashed)) {
     echo "YES, Matched";
}else{
    echo "No, Wrong Password";
}
0

Bhumi Shah ,

require_once($_SERVER['DOCUMENT_ROOT']."/wp-load.php");

.

but the hashed value for any password (number or text) is not one hard thing, there can be many things, so they can only be compared with wp_check_password

0
source

All Articles