-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathlogout.php
More file actions
31 lines (29 loc) · 729 Bytes
/
logout.php
File metadata and controls
31 lines (29 loc) · 729 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
<?php
session_start();
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Logout</title>
</head>
<body>
<script>
// Ask for confirmation before logout
var confirmLogout = confirm("Are you sure you want to logout?");
if (confirmLogout) {
// If user clicks OK → destroy session and go to login
<?php
session_unset();
session_destroy();
?>
alert("You have been logged out successfully!");
window.location.href = "login.php";
} else {
// If user clicks Cancel → go back to dashboard
alert("Logout cancelled.");
window.location.href = "employee.php"; // change to your dashboard file name
}
</script>
</body>
</html>