-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathlogout.php
More file actions
50 lines (36 loc) · 1.16 KB
/
logout.php
File metadata and controls
50 lines (36 loc) · 1.16 KB
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
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
<?php
session_start();
if(isset($_SESSION['id'])){
include_once "php/config.php";
if(isset($_POST['logout'])){
$status = "Offline now";
$sql = mysqli_query($conn, "UPDATE register SET status = '{$status}' WHERE id = {$_SESSION['id']}");
if($sql){
session_unset();
session_destroy();
header("Location: index.php");
}else{
header("Location: index.php");
}
}
}
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
<link rel="stylesheet" href="./css/boot4.css">
</head>
<body>
<form action="" method="post">
<div class="contaner d-flex d-flex-column" style="display: flex; flex-direction: column; justify-content: center; align-items: center; min-height: 60vh">
<header class="text-uppercase text-60">Are you sure you want to logout?</header>
<a href="index.php">Back</a>
<button type="submit" name="logout" class="btn btn-danger mt-4">Logout</button>
</div>
</form>
</body>
</html>