-
Notifications
You must be signed in to change notification settings - Fork 18
/
admin.php
37 lines (32 loc) · 1.21 KB
/
admin.php
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
<?php
session_start();
require_once 'config/db.php';
if (!isset($_SESSION['admin_login'])) {
$_SESSION['error'] = 'กรุณาเข้าสู่ระบบ!';
header('location: signin.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>User Page</title>
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.0.2/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-EVSTQN3/azprG1Anm3QDgpJLIm9Nao0Yz1ztcQTwFspd3yD65VohhpuuCOmLASjC" crossorigin="anonymous">
</head>
<body>
<div class="container">
<?php
if (isset($_SESSION['admin_login'])) {
$admin_id = $_SESSION['admin_login'];
$stmt = $conn->query("SELECT * FROM users WHERE id = $admin_id");
$stmt->execute();
$row = $stmt->fetch(PDO::FETCH_ASSOC);
}
?>
<h3 class="mt-4">Welcome Admin, <?php echo $row['firstname'] . ' ' . $row['lastname'] ?></h3>
<a href="logout.php" class="btn btn-danger">Logout</a>
</div>
</body>
</html>