This commit is contained in:
2025-11-02 14:51:56 +01:00
parent f2b78086dd
commit 7e550de5f0
4 changed files with 28 additions and 51 deletions

6
.idea/vcs.xml generated Normal file
View File

@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="VcsDirectoryMappings">
<mapping directory="$PROJECT_DIR$" vcs="Git" />
</component>
</project>

View File

@@ -1,5 +1,5 @@
<?php
require '../include/authenticator.php';
require '../include/auth.php';
$_SESSION = [];
@@ -15,3 +15,4 @@ if (!function_exists('logout_user')) {
header('Location: ../index.php');
exit;
?>

View File

@@ -1,7 +1,7 @@
<?php
global $pdo;
require '../include/db.php';
require '../include/authenticator.php';
require '../include/auth.php';
requireLogin();
$id = isset($_GET['id']) ? (int)$_GET['id'] : 0;
@@ -35,6 +35,7 @@ if ($_SERVER['REQUEST_METHOD'] === 'POST') {
}
}
?>
<!doctype html>
<html lang="fr">
<head>

View File

@@ -1,31 +0,0 @@
<?php
session_start();
function isLogged(): bool
{
return isset($_SESSION['user']);
}
function checkLogin(PDO $pdo, $login, $password): bool
{
$stmt = $pdo->prepare('SELECT * FROM utilisateur WHERE login = ?');
$stmt->execute([$login]);
$user = $stmt->fetch();
if ($user && password_verify($password, $user['password'])) {
$_SESSION['user'] = $user['login'];
return true;
}
return false;
}
function requireLogin() {
if (!isLogged()) {
header('Location: login.php');
exit;
}
}