53 lines
1.0 KiB
PHP
53 lines
1.0 KiB
PHP
<?php
|
|
|
|
|
|
|
|
class ControleurAuthentification{
|
|
|
|
public function coucou(){
|
|
echo " coucou ! ";
|
|
}
|
|
|
|
public function afficherFormCo(){
|
|
include __DIR__."/../vues/VueFormCo.php";
|
|
}
|
|
|
|
public function traiterFormCo(){
|
|
session_start();
|
|
require_once "../utils_inc/inc_pdo.php";
|
|
|
|
$login = $_POST["login"];
|
|
$pass = $_POST["pass"];
|
|
|
|
|
|
$textR = "select droit, password ";
|
|
$textR.= "from membre ";
|
|
$textR.= "where id=:login ";
|
|
$req = $pdo->prepare($textR);
|
|
$req->bindParam(":login", $login);
|
|
$req->execute();
|
|
|
|
|
|
$tabRes = $req->fetchAll(PDO::FETCH_ASSOC);
|
|
if (count($tabRes)!=1) {
|
|
|
|
header("Location:../index.php?message=tekitoa");
|
|
exit();
|
|
}
|
|
|
|
|
|
if (!password_verify($pass, $tabRes[0]["password"])){
|
|
|
|
header("Location:../index.php?message=tekitoa");
|
|
exit();
|
|
}
|
|
|
|
$_SESSION["login"] = $login;
|
|
$_SESSION["droit"] = $tabRes[0]["droit"];
|
|
|
|
header("Location:../vues/accueil.php");
|
|
|
|
}
|
|
|
|
|
|
} |