-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbackheader.php
216 lines (198 loc) · 12.3 KB
/
backheader.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
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
<?php
// Connect to the SQLite database
$db1 = new SQLite3('database.sqlite');
// Get the artist name from the database
$email1 = $_SESSION['email'];
$stmt1 = $db1->prepare("SELECT id, artist, pic FROM users WHERE email = :email");
$stmt1->bindValue(':email', $email1);
$result1 = $stmt1->execute();
$row1 = $result1->fetchArray();
$pic1 = $row1['pic'];
$artist1 = $row1['artist'];
$user_id1 = $row1['id'];
// Count the number of followers
$stmt1 = $db1->prepare("SELECT COUNT(*) AS num_followers FROM following WHERE following_email = :email");
$stmt1->bindValue(':email', $email1);
$result1 = $stmt1->execute();
$row1 = $result1->fetchArray();
$num_followers1 = $row1['num_followers'];
// Count the number of following
$stmt1 = $db1->prepare("SELECT COUNT(*) AS num_following FROM following WHERE follower_email = :email");
$stmt1->bindValue(':email', $email1);
$result1 = $stmt1->execute();
$row1 = $result1->fetchArray();
$num_following1 = $row1['num_following'];
// Get all of the images uploaded by the current user
$stmt1 = $db1->prepare("SELECT * FROM images WHERE email = :email ORDER BY id DESC");
$stmt1->bindValue(':email', $email1);
$result1 = $stmt1->execute();
// Count the number of images uploaded by the current user
$count1 = 0;
while ($image1 = $result1->fetchArray()) {
$count1++;
}
$fav_result1 = $db1->query("SELECT COUNT(*) FROM favorites WHERE email = '{$_SESSION['email']}'");
$fav_count1 = $fav_result1->fetchArray()[0];
?>
<nav class="navbar fixed-top navbar-expand-md navbar-light bg-body-tertiary">
<div class="container-fluid">
<button class="navbar-toggler1 d-md-none link-body-emphasis" type="button" onclick="goBack()">
<img src="icon/back.svg" width="22" height="22">
</button>
<a class="navbar-brand text-secondary fw-bold" href="index.php">
ArtCODE
</a>
<div class="dropdown nav-right">
<a class="btn btn-sm bg-body-secondary rounded-pill fw-bold dropdown-toggle d-none d-md-block d-lg-block p-1 pe-2 border border-light-subtle" type="button" data-bs-toggle="dropdown" data-bs-auto-close="false" aria-expanded="false">
<img class="rounded-circle border-0 object-fit-cover border border-1 m-0" width="24" height="24" src="<?php echo (isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] === 'on' ? 'https' : 'http') . '://' . $_SERVER['HTTP_HOST']; ?>/<?php echo !empty($pic1) ? $pic1 : "icon/profile.svg"; ?>" alt="Profile Picture" style="margin-top: -2px;">
<span><?php echo $artist1; ?></span>
</a>
<a class="nav-link px-2 text-secondary dropdown-toggle d-md-none d-lg-none" type="button" data-bs-toggle="dropdown" data-bs-auto-close="false" aria-expanded="false">
<img class="rounded-circle object-fit-cover border border-1" width="32" height="32" src="<?php echo (isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] === 'on' ? 'https' : 'http') . '://' . $_SERVER['HTTP_HOST']; ?>/<?php echo !empty($pic1) ? $pic1 : "icon/profile.svg"; ?>" alt="Profile Picture" style="margin-top: -2px;">
</a>
<ul class="dropdown-menu dropdown-menu-end rounded-4 shadow border-0" style="width: 300px;">
<div class="text-center mb-2">
<a class="d-block pt-2" href="<?php echo (isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] === 'on' ? 'https' : 'http') . '://' . $_SERVER['HTTP_HOST']; ?>/settings/profile_picture.php"><img class="rounded-circle object-fit-cover border border-5" width="150" height="150" src="<?php echo (isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] === 'on' ? 'https' : 'http') . '://' . $_SERVER['HTTP_HOST']; ?>/<?php echo !empty($pic1) ? $pic1 : "icon/profile.svg"; ?>" alt="Profile Picture"></a>
<h5 class="fw-bold mt-2 "><?php echo $artist1; ?></h5>
<p class="fw-medium" style="margin-top: -10px;"><small><?php echo $email1; ?></small></p>
</div>
<div class="btn-group mt-2 mb-1 w-100 container" role="group" aria-label="Basic example">
<a class="btn btn-sm btn-outline-dark rounded w-50 fw-bold <?php if(basename($_SERVER['PHP_SELF']) == 'follower.php') echo 'active' ?>" href="<?php echo (isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] === 'on' ? 'https' : 'http') . '://' . $_SERVER['HTTP_HOST']; ?>/follower.php?id=<?php echo $user_id1; ?>"><i class="bi bi-people-fill"></i> <?php echo $num_followers1 ?> <small>followers</small></a>
<a class="btn btn-sm btn-outline-dark ms-1 rounded w-50 fw-bold <?php if(basename($_SERVER['PHP_SELF']) == 'following.php') echo 'active' ?>" href="<?php echo (isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] === 'on' ? 'https' : 'http') . '://' . $_SERVER['HTTP_HOST']; ?>/following.php?id=<?php echo $user_id1; ?>"><i class="bi bi-person-fill"></i> <?php echo $num_following1 ?> <small>following</small></a>
</div>
<div class="btn-group mb-3 w-100 container" role="group" aria-label="Basic example">
<a class="btn btn-sm btn-outline-dark rounded w-50 fw-bold <?php if(basename($_SERVER['PHP_SELF']) == 'myworks.php') echo 'active' ?>" href="<?php echo (isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] === 'on' ? 'https' : 'http') . '://' . $_SERVER['HTTP_HOST']; ?>/myworks.php"><i class="bi bi-images"></i> <?php echo $count1; ?> <small>images</small></a>
<a class="btn btn-sm btn-outline-dark ms-1 rounded w-50 fw-bold <?php if(basename($_SERVER['PHP_SELF']) == 'favorite.php') echo 'active' ?>" href="<?php echo (isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] === 'on' ? 'https' : 'http') . '://' . $_SERVER['HTTP_HOST']; ?>/favorite.php"><i class="bi bi-heart-fill"></i> <?php echo $fav_count1;?> <small>favorites</small></a>
</div>
<div class="container">
<div class="btn-group w-100 gap-2 mb-1">
<a class="text-center dropdown-item w-50 hover-effect fw-bold mb-1 rounded <?php echo (basename($_SERVER['PHP_SELF']) == 'index.php' && strpos($_SERVER['PHP_SELF'], 'feeds/notification/') !== false) || (strpos($_SERVER['PHP_SELF'], '/profile/') !== false) ? 'text-white bg-darker rounded' : ((basename($_SERVER['PHP_SELF']) == 'profile') ? 'text-white bg-darker rounded' : 'text-s'); ?>" href="<?php echo (isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] === 'on' ? 'https' : 'http') . '://' . $_SERVER['HTTP_HOST']; ?>/profile.php">
Profile
</a>
<a class="text-center dropdown-item w-50 hover-effect fw-bold mb-1 rounded <?php echo (basename($_SERVER['PHP_SELF']) == 'index.php' && strpos($_SERVER['PHP_SELF'], 'feeds/favorites/') !== false) || (strpos($_SERVER['PHP_SELF'], '/feeds/favorites/') !== false) ? 'text-white bg-darker rounded' : ((basename($_SERVER['PHP_SELF']) == 'profile') ? 'text-white bg-darker rounded' : 'text-s'); ?>" href="<?php echo (isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] === 'on' ? 'https' : 'http') . '://' . $_SERVER['HTTP_HOST']; ?>/favorite.php">
Favorites
</a>
</div>
<div class="btn-group w-100 gap-2 mb-1">
<a class="text-center dropdown-item w-50 hover-effect fw-bold mb-1 rounded <?php echo (basename($_SERVER['PHP_SELF']) == 'album.php') ? 'text-white bg-darker rounded' : 'text-s'; ?>" href="<?php echo (isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] === 'on' ? 'https' : 'http') . '://' . $_SERVER['HTTP_HOST']; ?>/album.php">
My Albums
</a>
<a class="text-center dropdown-item w-50 hover-effect fw-bold mb-1 rounded <?php echo (basename($_SERVER['PHP_SELF']) == 'myworks.php') ? 'text-white bg-darker rounded' : 'text-s'; ?>" href="<?php echo (isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] === 'on' ? 'https' : 'http') . '://' . $_SERVER['HTTP_HOST']; ?>/myworks.php">
My Works
</a>
</div>
<div class="btn-group w-100 gap-2">
<a class="text-center dropdown-item w-50 hover-effect fw-bold mb-1 rounded <?php echo (basename($_SERVER['PHP_SELF']) == 'setting.php') ? 'text-white bg-darker rounded' : 'text-s'; ?>" href="<?php echo (isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] === 'on' ? 'https' : 'http') . '://' . $_SERVER['HTTP_HOST']; ?>/setting.php">
Settings
</a>
<a class="text-center dropdown-item w-50 hover-effect fw-bold mb-1 rounded <?php echo (basename($_SERVER['PHP_SELF']) == 'index.php' && strpos($_SERVER['PHP_SELF'], 'feeds/history/') !== false) || (strpos($_SERVER['PHP_SELF'], '/feeds/history/') !== false) ? 'text-white bg-darker rounded' : ((basename($_SERVER['PHP_SELF']) == 'profile') ? 'text-white bg-darker rounded' : 'text-s'); ?>" href="<?php echo (isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] === 'on' ? 'https' : 'http') . '://' . $_SERVER['HTTP_HOST']; ?>/history.php">
History
</a>
</div>
</div>
<div class="mx-1">
<hr class="border-3 rounded">
<div class="container-fluid mb-2">
<?php if(isset($_SESSION['email']) && isset($_COOKIE['token'])): ?>
<li>
<a class="btn btn-danger fw-bold w-100 rounded-3" href="#" data-bs-toggle="modal" data-bs-target="#logOut">
<i class="bi bi-door-open-fill"></i> Logout
</a>
</li>
<?php else: ?>
<li>
<a class="btn btn-primary fw-bold w-100 <?php echo (basename($_SERVER['PHP_SELF']) == 'session.php'); ?>" href="<?php echo (isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] === 'on' ? 'https' : 'http') . '://' . $_SERVER['HTTP_HOST']; ?>/session.php">
Signin
</a>
</li>
<?php endif; ?>
</div>
</div>
</ul>
</div>
</div>
</nav>
<!-- Modal -->
<div class="modal fade" id="logOut" tabindex="-1" aria-labelledby="exampleModalLabel" aria-hidden="true">
<div class="modal-dialog" role="document">
<div class="modal-content rounded-3 shadow">
<div class="modal-body p-4 text-center">
<h5 class="mb-0">Do you want to end the session?</h5>
<p class="mb-0 mt-2">You can always comeback whenever you want later.</p>
</div>
<div class="modal-footer flex-nowrap p-0">
<a class="btn btn-lg btn-link text-danger fs-6 text-decoration-none col-6 py-3 m-0 rounded-0 border-end" href="logout.php"><strong>Yes, end the session!</strong></a>
<button type="button" class="btn btn-lg btn-link fs-6 text-decoration-none col-6 py-3 m-0 rounded-0" data-bs-dismiss="modal">Cancel, keep it!</button>
</div>
</div>
</div>
</div>
<style>
@media (min-width: 768px) {
.navbar-nav {
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
}
.nav-center {
margin-left: 15px;
margin-right: 15px;
}
.width-vw {
width: 89vw;
}
.nav-right {
position: absolute;
right: 10px;
top: 10;
align-items: center;
}
}
@media (max-width: 767px) {
.navbar-brand {
position: static;
display: block;
text-align: center;
margin: auto;
transform: none;
}
.d-none-sm {
display: none;
}
.width-vw {
width: 75vw;
}
.navbar-brand {
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
font-size: 18px;
}
}
.navbar {
height: 45px;
}
.navbar-brand {
font-size: 18px;
}
@media (min-width: 992px) {
.navbar-toggler1 {
display: none;
}
}
.navbar-toggler1 {
background-color: <?php include($_SERVER['DOCUMENT_ROOT'] . '/appearance/opposite.php'); ?>;
border: none;
font-size: 8px;
margin-top: -2px;
border-radius: 5px;
padding: 6px;
transition: background-color 0.3s ease;
}
</style>