简体   繁体   English

如何通过php代码将(输入的密码)与(wordpress数据库中的加密密码)进行比较

[英]how to compare (entered password) with (encrypted password in wordpress database) by php code

I have an android app of wordpress website我有一个 wordpress 网站的 android 应用程序
in the codes in sever side I have added this code to compare between entered user,password and the user,pass that stored in the db在服务器端的代码中,我添加了此代码来比较输入的用户、密码和用户、存储在数据库中的密码
the problem is that the pass in user_pass table was encrypted in wordpress ...问题是 user_pass 表中的 pass 是在 wordpress 中加密的...
what can I do ?我能做什么 ?

    "connect.php" for connecting to db
    <?php
    include "connect.php";
    $name=$_POST["name"];
    $pass=$_POST["pass"];
$query="SELECT * FROM wp_users WHERE user_login=:name AND user_pass=:pass";    
    $result=$connect->prepare($query);
    $result->bindParam(":name",$name);
    $result->bindParam(":pass",$pass);
    $result->execute();
    $row=$result->fetch(PDO::FETCH_ASSOC);
    if($row==false)
    {
    echo "you are not signing in";
    }
    else
    {
    echo $row["display_name"];
    }
    ?>

You must know how the stored password was encrypted.您必须知道存储的密码是如何加密的。 Then encrypt the input password with the same algorithm and keys.然后使用相同的算法和密钥加密输入密码。 That is when you can compare the 2 passwords.那是您可以比较两个密码的时候。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM