我想创建一个忘记密码的系统[关闭]

这是我的过程PHP

'''

$db = mysqli_connect('localhost', 'root', '', 'loginsystem');
  $username = "";
  $email = "";
  if (isset($_POST['register'])) {
    $username = $_POST['username'];
    $email = $_POST['email'];
    $password = $_POST['password'];

    $sql_u = "SELECT * FROM users WHERE username='$username'";
    $sql_e = "SELECT * FROM users WHERE email='$email'";
    $res_u = mysqli_query($db, $sql_u);
    $res_e = mysqli_query($db, $sql_e);

    if (mysqli_num_rows($res_u) > 0) {
      $name_error = "Sorry, this username is owned...";     
    }else if(mysqli_num_rows($res_e) > 0){
      $email_error = "Sorry, but this email is owned...";   
    }else{
           $query = "INSERT INTO users (username, email, password) 
                  VALUES ('$username', '$email', '".md5($password)."')";
           $results = mysqli_query($db, $query);
           header ('location:dashboard.php');
           exit();
    }
  }

''' 如何创建密码请求系统? 我想让它尽可能简单。

评论