-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgames.php
132 lines (122 loc) · 2.98 KB
/
games.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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
<?php
session_start();
include('config/db.php');
if(empty($_SESSION['token']) || empty($_SESSION['email']) || empty($_SESSION['username']) || empty($_SESSION['user_id'])) {
header('Location: index.php');
exit();
}
$username = $_SESSION['username'];
$user_id = $_SESSION['user_id'];
$email = $_SESSION['email'];
$token = $_SESSION['token'];
$profile_pic = "./img/user.png";
$query = mysqli_query($conn,"SELECT * FROM users WHERE id = '$user_id'");
if(mysqli_num_rows($query) == 0) {
header('Location: index.php');
exit();
}
if($row = mysqli_fetch_assoc($query)){
if($row['pic'] != NULL){
$profile_pic = $row['pic'];
}
}
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Game History</title>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/meyer-reset/2.0/reset.min.css">
<link rel="shortcut icon" href="./img/logo.png" type="image/x-icon">
<link rel="stylesheet" href="css/dashboard.css">
</head>
<body>
<div class="app">
<header class="app-header">
<div class="app-header-logo">
<div class="logo">
<span class="logo-icon">
<img src="./img/dashboard.png" />
</span>
<h1 class="logo-title">
<span>MyChess</span>
<span>Dashboard</span>
</h1>
</div>
</div>
<div class="app-header-navigation">
<div class="tabs">
<a href="./dashboard.php">
Overview
</a>
<a href="./play.php">
Play
</a>
<a href="./profile.php">
Account
</a>
<a href="./friends.php">
Friends
</a>
<a href="./games.php" class="active">
Match History
</a>
</div>
</div>
<div class="app-header-actions">
<button class="user-profile">
<span><?=$username?></span>
<span>
<img src="<?=$profile_pic?>" />
</span>
</button>
</div>
<div class="app-header-mobile">
<button class="icon-button large">
<i class="ph-list"></i>
</button>
</div>
</header>
<div class="app-body">
<div class="app-body-navigation">
<nav class="navigation">
<a href="./dashboard.php">
<i class="ph-crown-simple"></i>
<span>Dashboard</span>
</a>
<a href="./profile.php">
<i class="ph-user"></i>
<span>Profile</span>
</a>
<a href="./games.php">
<i class="ph-game-controller"></i>
<span>Games</span>
</a>
<a href="./logout.php">
<i class="ph-sign-out"></i>
<span>Log Out</span>
</a>
</nav>
<footer class="footer">
<h1>MyChess<small>©</small></h1>
<div>
MyChess ©<br />
All Rights Reserved 2024
</div>
</footer>
</div>
<div class="dashboard">
<?php include 'config/history.php'; ?>
</div> <!-- Dashboard | Overview -->
</div>
</div>
<!-- partial -->
<script src='https://unpkg.com/phosphor-icons'></script>
<script>
document.querySelector('.user-profile').addEventListener('click', () => {
window.location.href = 'profile.php';
});
</script>
</body>
</html>