forked from engineerOfLies/rabbitmqphp_example
-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathnav.php
More file actions
74 lines (72 loc) · 2.93 KB
/
Copy pathnav.php
File metadata and controls
74 lines (72 loc) · 2.93 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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
<?php
require_once("get_url.php");
?>
<!-- nav.php -->
<nav class="navbar navbar-expand-lg bg-body-tertiary">
<div class="container-fluid">
<a class="navbar-brand" href="#">EventPulse</a>
<button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#navbarSupportedContent" aria-controls="navbarSupportedContent" aria-expanded="false" aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span>
</button>
<div class="collapse navbar-collapse" id="navbarSupportedContent">
<ul class="navbar-nav me-auto mb-2 mb-lg-0">
<li class="nav-item">
<a class="nav-link" href="<?php echo get_url('/home.php'); ?>">Home</a>
</li>
<li class="nav-item">
<a class="nav-link" href="<?php echo get_url('/search.php'); ?>">Search</a>
</li>
<li class="nav-item">
<a class="nav-link" href="<?php echo get_url('/likes.html'); ?>">Liked Events</a>
</li>
<li class="nav-item">
<a class="nav-link" href="<?php echo get_url('/friends.php'); ?>">Friends</a>
</li>
<li class="nav-item">
<a class="nav-link" href="<?php echo get_url('/remind_me.html'); ?>">Notifications</a>
</li>
<li class="nav-item">
<a class="nav-link" href="<?php echo get_url('/recommendations.html'); ?>">Recommendations</a>
</li>
<li class="nav-item">
<a class="nav-link" href="<?php echo get_url('/follow_artists.php'); ?>">Follow Artists</a>
</li>
<li class="nav-item">
<a class="nav-link" href="<?php echo get_url('/following.php'); ?>">Following</a>
</li>
</ul>
<!-- Only Logout Button -->
<div class="d-flex align-items-center">
<form class="d-flex" role="button">
<button class="btn btn-outline-danger" type="button" onclick="logout()">Logout</button>
</form>
</div>
</div>
</div>
</nav>
<script>
function logout() {
const token = localStorage.getItem("token");
if (token) {
fetch('logout.php', {
method: 'POST',
headers: { 'Content-Type': 'application/x-www-form-urlencoded' },
body: 'token=' + encodeURIComponent(token),
})
.then(response => response.json())
.then(data => {
if (data.status === "success") {
localStorage.removeItem("token");
window.location.href = "index.html";
} else {
console.error('Logout failed:', data.message);
}
})
.catch(error => {
console.error('Error:', error);
});
} else {
window.location.href = "index.html";
}
}
</script>