Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- include("config.php");
- if(!$_SERVER["REQUEST_METHOD"] == "POST") {
- die("Accès non autorisé");
- }
- if(strlen($_POST["username"]) <= 0 or strlen($_POST["password"]) <= 0) {
- die("Vous devez entrer un nom d’utilisateur et un mot de passe");
- }
- $username = $_POST["username"];
- $password = hashpassword($_POST["password"]);
- $check_credentials_query = $mysql->prepare("SELECT * FROM membres WHERE username=':username' AND password=':password'");
- $check_credentials = $check_credentials_query->execute(array(':password' => $password, ':username' => $username));
- if($check_credentials->rowCount() == 1) {
- // Suite du code à placer ici.
- } else {
- die("Mauvais couple d’identifiants.");
- }
Add Comment
Please, Sign In to add comment