-
Notifications
You must be signed in to change notification settings - Fork 1
/
home.php
179 lines (158 loc) · 4.92 KB
/
home.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
<?php
include 'config/database.php';
session_start();
$user_name = $_SESSION['name'];
$id = $_SESSION['id'];
if(!isset($user_name)){
header('location: login.php');
}
$user_id = $_SESSION['id'];
$sql = "SELECT * FROM alumni_table WHERE id = $user_id";
$result = mysqli_query($conn, $sql);
if ($result) {
$row = mysqli_fetch_array($result);
}
// Fetch all users from the database
$fetch_all_sql = "SELECT * FROM alumni_table";
$results = mysqli_query($conn, $fetch_all_sql);
if ($results) {
$alumni_information = mysqli_fetch_all($results, MYSQLI_ASSOC);
}
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="stylesheet" href="dashboard.css">
<style>
body {
font-family: Arial, sans-serif;
margin: 0;
padding: 0;
background-color: #f4f4f4;
}
.navbar {
background-color: #4caf50;
padding: 15px 20px;
border-bottom: 1px solid #ddd;
color: #fff;
}
.navbar-brand {
font-size: 24px;
font-weight: bold;
}
.navbar-nav {
margin-top: 10px;
list-style: none;
display: flex;
}
.navbar-nav .nav-item {
margin-right: 15px;
font-size: 18px;
}
.navbar-nav .nav-item a {
text-decoration: none;
color: #fff;
}
.navbar-nav .nav-item a:hover {
color: #333;
}
.container {
width: 80%;
margin: auto;
overflow: hidden;
padding: 20px;
}
h1 {
text-align: center;
color: #333;
}
table {
width: 100%;
border-collapse: collapse;
margin-top: 20px;
}
th, td {
border: 1px solid #ddd;
padding: 8px;
text-align: left;
}
th {
background-color: #4caf50;
color: white;
}
button {
background-color: #4caf50;
color: #fff;
padding: 8px;
margin-right: 5px;
border: none;
cursor: pointer;
}
button:hover {
background-color: #45a049;
}
td img {
max-width: 50px;
max-height: 50px;
border-radius: 50%;
}
</style>
</head>
<body>
<nav class="navbar">
<div class="navbar-brand">
<img src="<?php echo $row['profilePicture']; ?>" alt="Profile Picture" style="max-width: 40px; border-radius: 50%;">
</div>
<ul class="navbar-nav ml-auto">
<li class="nav-item"><a href="index.php">Home</a></li>
<li class="nav-item"><a href="profile.php">Profile</a></li>
<li class="nav-item"><a href="logout.php">Logout</a></li>
</ul>
</nav>
<div class="container mt-4">
<h3>Hey <?php echo $row['name'] ?></h3>
<div class="row">
<div class="col">
<h2>All Alumni Information</h2>
<table>
<thead>
<tr>
<th>ID</th>
<th>Profile Picture</th>
<th>Name</th>
<th>Email</th>
<th>Graduation Year</th>
<th>Major</th>
<th>Occupation</th>
<th>Time Created</th>
<th>Operations</th>
</tr>
</thead>
<tbody>
<?php foreach ($alumni_information as $info): ?>
<tr>
<td><?php echo $info['id']; ?></td>
<td><img src="<?php echo $info['profilePicture']; ?>"></td>
<td><?php echo $info['name']; ?></td>
<td><?php echo $info['email']; ?></td>
<td><?php echo $info['gradYear']; ?></td>
<td><?php echo $info['major']; ?></td>
<td><?php echo $info['occupation']; ?></td>
<td><?php echo $info['time']; ?></td>
<?php if($info['id'] == $user_id):?>
<td>
<a class = "edit" href="edit2.php?id=<?php echo $info['id']; ?>">Edit</a>
</td>
<?php else: ?>
<?php endif; ?>
</tr>
<?php endforeach; ?>
</tbody>
</table>
</div>
</div>
</div>
</body>
</html>