Home > Backend Development > PHP Tutorial > PHP implementation code for retrieving password function based on questions

PHP implementation code for retrieving password function based on questions

WBOY
Release: 2016-07-25 09:00:10
Original
1475 people have browsed it
  1. 根据问题取回密码_bbs.it-home.org
  2. 请输入您的用户名
    用户名
复制代码

第二步:

  1. 取回密码2
  2. require_once ('conn.php');
  3. $sql = "select * from member where username='$_POST[username]'";
  4. $result =mysql_query($sql,$conn);
  5. if ($rs =mysql_fetch_array($result)){
  6. ?>
  7. $sql = "select * from member where username='$_POST[username]'";
  8. $result =mysql_query($sql,$conn);
  9. $rs =mysql_fetch_array($result);
  10. ?>
  11. 请输入根据提示问题输入问题答案
  12. 用户名
  13. " />
  14. 密码提示
  15. 问题答案
  16. }else{
  17. echo ""; //用javascript脚本提示用户;
  18. }
  19. ?>
复制代码

Step 3

  1. Retrieve password 3
  2. require_once ('conn.php');
  3. $sql = "select * from member where id=$_POST[id]";
  4. $result =mysql_query($sql,$conn);
  5. $rs =mysql_fetch_array($result);
  6. ?>

  7. Congratulations, your password has been retrieved, please remember it and don't forget it!
    < ;/td>
  8. This is your username and password, don't forget it!
    username
  9. password
  10. if ($_POST["answer"]==$rs["answer"]) {
  11. echo $rs["password"];
  12. session_register("username");
  13. $username =$rs[username];
  14. $aaa=$rs[username];
  15. }else{
  16. echo("");
  17. }
  18. ?>
  19. < /body>
Copy code


source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template