19 lines
498 B
PHP
19 lines
498 B
PHP
<?php
|
|
session_start();
|
|
|
|
require_once 'db/config.php';
|
|
|
|
if (isset($_SESSION['attendance_id'])) {
|
|
$db = db();
|
|
$logout_time = date('Y-m-d H:i:s');
|
|
$attendance_stmt = $db->prepare("UPDATE attendance SET logout_time = :logout_time WHERE id = :id");
|
|
$attendance_stmt->bindParam(':logout_time', $logout_time);
|
|
$attendance_stmt->bindParam(':id', $_SESSION['attendance_id']);
|
|
$attendance_stmt->execute();
|
|
}
|
|
|
|
session_unset();
|
|
session_destroy();
|
|
header("Location: login.php");
|
|
exit();
|