Guest User

Untitled

a guest
Aug 27th, 2018
114
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.70 KB | None | 0 0
  1. <?php
  2. include("config.php");
  3.  
  4. if(!$_SERVER["REQUEST_METHOD"] == "POST") {
  5.     die("Accès non autorisé");
  6. }
  7.  
  8. if(strlen($_POST["username"]) <= 0 or strlen($_POST["password"]) <= 0) {
  9.     die("Vous devez entrer un nom d’utilisateur et un mot de passe");
  10. }
  11.  
  12. $username = $_POST["username"];
  13. $password = hashpassword($_POST["password"]);
  14.  
  15. $check_credentials_query = $mysql->prepare("SELECT * FROM membres WHERE username=':username' AND password=':password'");
  16. $check_credentials = $check_credentials_query->execute(array(':password' => $password, ':username' => $username));
  17.  
  18. if($check_credentials->rowCount() == 1) {
  19.     // Suite du code à placer ici.
  20. } else {
  21.     die("Mauvais couple d’identifiants.");
  22. }
Add Comment
Please, Sign In to add comment