feat : mise en place d'un routeur et form de co OK
This commit is contained in:
42
controleurs/ControleurAuthentification.php
Normal file
42
controleurs/ControleurAuthentification.php
Normal file
@@ -0,0 +1,42 @@
|
||||
<?php
|
||||
|
||||
class ControleurAuthentification {
|
||||
|
||||
public function coucou() {
|
||||
echo "Coucou";
|
||||
}
|
||||
|
||||
public function afficherFormCo() {
|
||||
include __DIR__ . "/../vue/VueFormCo.php";
|
||||
}
|
||||
|
||||
public function traiterFormCo($cnx) {
|
||||
$login = $_POST["login"];
|
||||
$pass = $_POST["pass"];
|
||||
|
||||
|
||||
$textR = "select droit, password ";
|
||||
$textR.= "from membre ";
|
||||
$textR.= "where id=:login ";
|
||||
$req = $cnx->prepare($textR);
|
||||
$req->bindParam(":login", $login);
|
||||
$req->execute();
|
||||
|
||||
$tabRes = $req->fetchAll(PDO::FETCH_ASSOC);
|
||||
if (count($tabRes)!=1) {
|
||||
include __DIR__ . "/../vue/VueFormCo.php";
|
||||
exit();
|
||||
}
|
||||
|
||||
if (!password_verify($pass, $tabRes[0]["password"])){
|
||||
include __DIR__ . "/../vue/VueFormCo.php";
|
||||
exit();
|
||||
}
|
||||
|
||||
$_SESSION["login"] = $login;
|
||||
$_SESSION["droit"] = $tabRes[0]["droit"];
|
||||
|
||||
echo "TODO : aller sur la page d'accueil";
|
||||
}
|
||||
|
||||
}
|
6
public/css/bootstrap.min.css
vendored
Normal file
6
public/css/bootstrap.min.css
vendored
Normal file
File diff suppressed because one or more lines are too long
10
public/css/styles.css
Normal file
10
public/css/styles.css
Normal file
@@ -0,0 +1,10 @@
|
||||
#formLogin{
|
||||
background-color: rgb(232, 238, 239);
|
||||
border:1px solid darkcyan;
|
||||
border-radius: 10px;
|
||||
padding: 15px;
|
||||
}
|
||||
|
||||
td a {
|
||||
color: white !important;;
|
||||
}
|
42
public/index.php
Normal file
42
public/index.php
Normal file
@@ -0,0 +1,42 @@
|
||||
<?php
|
||||
|
||||
session_start();
|
||||
require_once __DIR__ . "/../controleurs/ControleurAuthentification.php";
|
||||
// require_once __DIR__ . "/../utils_inc/inc_pdo.php";
|
||||
|
||||
define("BASE_URL", "/contribEvo/");
|
||||
|
||||
$pdo = new PDO('mysql:host=mysqlsrv;dbname=contrib', "contrib_root", "123abc");
|
||||
|
||||
// index.php?=route=maRoute¶m1=truc
|
||||
// => route reçu en get
|
||||
|
||||
$route = isset($_GET['route']) ? $_GET['route'] : null;
|
||||
|
||||
/*
|
||||
if (isset($_GET["route"])) {
|
||||
$route = $_GET["route"];
|
||||
} else {
|
||||
$route = null;
|
||||
}
|
||||
*/
|
||||
|
||||
if ($route == "coucou"){
|
||||
$ctr = new ControleurAuthentification();
|
||||
$ctr->coucou();
|
||||
exit();
|
||||
}
|
||||
|
||||
if ($route == "afficherFormCo") {
|
||||
$ctr = new ControleurAuthentification();
|
||||
$ctr->afficherFormCo();
|
||||
exit();
|
||||
}
|
||||
|
||||
if ($route == "traiterFormCo") {
|
||||
$ctr = new ControleurAuthentification();
|
||||
$ctr->traiterFormCo($pdo);
|
||||
exit();
|
||||
}
|
||||
|
||||
echo "Route inconnue";
|
7
public/js/bootstrap.bundle.min.js
vendored
Normal file
7
public/js/bootstrap.bundle.min.js
vendored
Normal file
File diff suppressed because one or more lines are too long
36
vue/VueFormCo.php
Normal file
36
vue/VueFormCo.php
Normal file
@@ -0,0 +1,36 @@
|
||||
<?php
|
||||
|
||||
?>
|
||||
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<link href="<?=BASE_URL?>public/css/bootstrap.min.css" rel="stylesheet">
|
||||
<link href="<?=BASE_URL?>public/css/styles.css" rel="stylesheet">
|
||||
<title>Connexion</title>
|
||||
</head>
|
||||
|
||||
<body class="container">
|
||||
<div class="row justify-content-center">
|
||||
<div class="col-md-4">
|
||||
<form id="formLogin" action="<?=BASE_URL?>public/index.php?route=traiterFormCo" method="post">
|
||||
<h3 class="text-center">Identifiez-vous</h3>
|
||||
<div class="form-group">
|
||||
<label for="id">Login :</label><br>
|
||||
<input type="text" name="login" id="id" class="form-control">
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="mdp">Pass :</label><br>
|
||||
<input type="password" name="pass" id="mdp" class="form-control">
|
||||
</div>
|
||||
<br>
|
||||
<div class="form-group text-end">
|
||||
<input type="submit" name="submit" class="btn btn-primary btn-md" value="Valider">
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</body>
|
||||
|
||||
</html>
|
Reference in New Issue
Block a user