Skip to content

Commit

Permalink
style: docs updated and commented
Browse files Browse the repository at this point in the history
  • Loading branch information
We1337-alpha committed Mar 10, 2024
1 parent 3649c4b commit 1dde722
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions src/Admin/logout.php
Original file line number Diff line number Diff line change
@@ -1,20 +1,29 @@
<?php

// Start the session to access session variables
session_start();

// Include the configuration file
require_once("../Modules/config.php");

// Get the username from the session
$username = $_SESSION['admin']['username'];

// Prepare and execute the query to update the logout time for the admin
$time = $conn->prepare('UPDATE `Admins` SET `LogoutTime` = CURRENT_TIMESTAMP WHERE `Username` = :username');
$time->bindParam(':username', $username, PDO::PARAM_STR);
$time->execute();
$conn=null;

// Close the database connection
$conn = null;

// Clear all session variables
$_SESSION = array();

// Destroy the session
session_destroy();

// Redirect to the login page
header("Location: login.php");

// Ensure that no further code is executed after redirection
exit();

0 comments on commit 1dde722

Please sign in to comment.