-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathuser.php
More file actions
49 lines (44 loc) · 1.13 KB
/
user.php
File metadata and controls
49 lines (44 loc) · 1.13 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
<?php
require 'includes/common.php';
if (!isset($_SESSION['id'])) {
header('Location: ./');
exit;
}
$con = connect();
$sessionId = $_SESSION['id'];
$getUser = mysqli_query($con, 'SELECT * FROM users WHERE id = ' . $sessionId);
$user = mysqli_fetch_assoc($getUser);
if (empty($user)) {
session_destroy();
header('Location: ./');
exit;
}
?>
<!DOCTYPE html>
<html lang="en">
<head>
<?php require 'includes/head.php'; ?>
</head>
<body>
<div class="container">
<h1>Hello, <?php echo $user['username']; ?></h1>
<?php
if ($user['is_admin'] == 1) {
?>
<div class="alert alert-info">
You are an admin!
</div>
<?php
}
else {
?>
<div class="alert alert-warning">
You suck!
</div>
<?php
}
?>
<a href="./logout.php" class="btn btn-danger">Logout</a>
</div>
</body>
</html>