-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
3649c4b
commit 1dde722
Showing
1 changed file
with
11 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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(); |