Skip to content

Commit 50c5d1b

Browse files
committed
Update actions/users/logoutAction.php
1 parent ae98af7 commit 50c5d1b

1 file changed

Lines changed: 6 additions & 2 deletions

File tree

actions/users/logoutAction.php

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,19 +12,23 @@
1212
require '../functions/logFunction.php';
1313
session_start();
1414

15-
SaveLog($bdd, $_SERVER['REQUEST_URI'], 'Déconnexion', 'Aucun commentaire.');
15+
$deleteCookies = $bdd->prepare('DELETE FROM cookies WHERE user_id = ?');
16+
$deleteCookies->execute(array($_SESSION['id']));
1617

1718
$_SESSION = [];
1819
session_destroy();
1920
setcookie(
2021
"auth_token",
2122
"",
2223
[
23-
"expires" => time() - 3600, // date passée → suppression
24+
"expires" => time() - 3600,
2425
"path" => "/",
2526
"secure" => true,
2627
"httponly" => true,
2728
"samesite" => "Strict"
2829
]
2930
);
31+
32+
SaveLog($bdd, $_SERVER['REQUEST_URI'], 'Déconnexion', 'Aucun commentaire.');
33+
3034
header('Location: ../../login.php');

0 commit comments

Comments
 (0)