-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathheader.php
executable file
·190 lines (168 loc) · 6.99 KB
/
header.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
<?php
ob_start(); // Start output buffering to prevent header issues
// Start the session if not already started
if (session_status() === PHP_SESSION_NONE) {
session_start();
}
// Determine the logged-in user's name or default to 'Guest'
$logged_in_user = 'Guest';
// Initialize role
$user_role = 'guest'; // Default role
if (isset($_SESSION['username'])) {
$logged_in_user = $_SESSION['username']; // For admins and users
// Check if role is set in session
if (isset($_SESSION['role'])) {
$user_role = $_SESSION['role'];
}
} elseif (isset($_SESSION['player_name'])) {
$logged_in_user = $_SESSION['player_name']; // For players
$user_role = 'player'; // Assign a role for players if necessary
}
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Badminton Tournament</title>
<style>
/* Reset margins and padding for the body */
body {
margin: 0;
padding: 0;
font-family: Arial, sans-serif;
line-height: 1.5;
}
/* Header styling */
.header {
display: flex;
justify-content: space-between;
align-items: center;
background-color: #f4f4f4;
padding: 10px 20px;
border-bottom: 1px solid #ccc;
}
/* Welcome message */
.header .welcome {
font-size: 14px;
color: #333;
}
/* Links container */
.header .links {
display: flex;
gap: 15px;
align-items: center;
}
/* Individual links */
.header .links a {
text-decoration: none;
color: #333;
font-size: 14px;
}
/* Dropdown styling */
.dropdown {
position: relative;
}
.dropdown-content {
display: none;
position: absolute;
top: 100%;
left: 0;
background-color: #f9f9f9;
box-shadow: 0px 8px 16px rgba(0, 0, 0, 0.2);
z-index: 1;
min-width: 220px;
border-radius: 4px;
}
.dropdown-content a {
color: #333;
text-decoration: none;
display: block;
padding: 10px 16px;
border-bottom: 1px solid #ddd;
}
.dropdown-content a:last-child {
border-bottom: none;
}
.dropdown:hover .dropdown-content {
display: block;
}
</style>
<link rel="stylesheet" type="text/css" href="styles1.css">
</head>
<body>
<div class="header">
<!-- Welcome Message -->
<div class="welcome">
<span>Welcome, <?= htmlspecialchars($logged_in_user) ?></span>
</div>
<!-- Navigation Links -->
<div class="links">
<a href="dashboard.php">Dashboard</a>
<a href="register.php">Register Tournament Manager</a>
<a href="register_player.php">Register Player</a>
<?php if ($user_role === 'admin'): ?>
<!-- Dropdown: Admin Zone (Only Visible to Admins) -->
<div class="dropdown">
<a href="#">Admin Zone</a>
<div class="dropdown-content">
<a href="register_user_adminaccess.php">Edit Tournament Manager</a>
<a href="edit_register_player.php">Edit Player</a>
<a href="insert_match.php">Insert Match</a>
<a href="insert_category.php">Insert Category</a>
<a href="add_moderator.php">Add Moderator</a>
<a href="insert_tournament.php">Insert Tournament</a>
</div>
</div>
<?php endif; ?>
<!-- Dropdown: Singles Matches -->
<div class="dropdown">
<a href="#">Singles Matches</a>
<div class="dropdown-content">
<?php if ($user_role === 'admin' || $user_role === 'moderator'|$user_role === 'user'): ?><a href="insert_match.php">Add Singles</a><?php endif; ?>
<a href="results_singles.php">Singles Results</a>
<?php if ($user_role === 'admin' || $user_role === 'moderator'|$user_role === 'user'): ?><a href="edit_results_singles_link.php">Edit Singles Matches</a><?php endif; ?>
</div>
</div>
<!-- Dropdown: Boys Doubles -->
<div class="dropdown">
<a href="#">Boys Doubles</a>
<div class="dropdown-content">
<?php if ($user_role === 'admin' || $user_role === 'moderator'|$user_role === 'user'): ?><a href="insert_match_bd.php">Insert Boys Doubles</a><?php endif; ?>
<a href="results_bd.php">Result Boys Doubles</a>
<?php if ($user_role === 'admin' || $user_role === 'moderator'|$user_role === 'user'): ?><a href="edit_results_bd.php">Edit Boys Doubles</a><?php endif; ?>
<?php if ($user_role === 'admin' || $user_role === 'moderator'|$user_role === 'user'): ?><a href="edit_results_doubles.php">Edit All Doubles</a><?php endif; ?>
</div>
</div>
<!-- Dropdown: Girls Doubles -->
<div class="dropdown">
<a href="#">Girls Doubles</a>
<div class="dropdown-content">
<?php if ($user_role === 'admin' || $user_role === 'moderator'|$user_role === 'user'): ?><a href="insert_match_gd.php">Insert Girls Doubles</a><?php endif; ?>
<a href="results_gd.php">Result Girls Doubles</a>
<?php if ($user_role === 'admin' || $user_role === 'moderator'|$user_role === 'user'): ?><a href="edit_results_gd.php">Edit Girls Doubles</a><?php endif; ?>
</div>
</div>
<!-- Dropdown: Mixed Doubles -->
<div class="dropdown">
<a href="#">Mixed Doubles</a>
<div class="dropdown-content">
<?php if ($user_role === 'admin' || $user_role === 'moderator'|$user_role === 'user'):?><a href="insert_match_xd.php">Create Mixed Doubles</a><?php endif; ?>
<a href="results_xd.php">Results Mixed Doubles</a>
<?php if ($user_role === 'admin' || $user_role === 'moderator'|$user_role === 'user'): ?><a href="edit_results_xd.php">Edit Mixed Doubles</a><?php endif; ?>
</div>
</div>
<!-- Dropdown: Player Ranking -->
<div class="dropdown">
<a href="#">Player Ranking</a>
<div class="dropdown-content">
<a href="ranking_singles.php">Singles Ranking</a>
<a href="ranking_doubles.php">Double & Mixed Doubles</a>
</div>
</div>
<!-- Logout -->
<a href="logout.php">Logout</a>
</div>
</div>
</body>
</html>