-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathattendees.php
89 lines (81 loc) · 3.17 KB
/
attendees.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
<?php
include_once("db-manager.php");
include_once("sessions.php");
$user_type = $_SESSION['type'];
if(!SessionManager::isLoggedIn() || $user_type == 'user'){
header("location:http://localhost/website-v2/index");
}
$sql = "SELECT * FROM `attendees`";
$result = mysqli_query($cxn, $sql) or die(mysqli_error($cxn));
$total_rows = mysqli_num_rows($result);
if(isset($_GET["id"]) && $_GET["action"] == "delete"){
$user_id = $_GET["id"];
$sql = "DELETE FROM `attendees` WHERE `id` = '$user_id'";
mysqli_query($cxn, $sql) or die(mysqli_error($cxn));
header("location:attendees.php");
}
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Attendees</title>
<link rel="stylesheet" href="./css/about.css?version = 1.0.0">
<link rel="stylesheet" href="./css/attendees.css">
</head>
<body>
<nav>
<img src="./images/icons8-menu-rounded-50.png" alt="" id="menu" onclick="menuOpen()">
<img src="./images/icon-close.svg" alt="" id="close" onclick="menuClose()">
<main>
<a href="./index"><img src="./images/navLogo.png" alt="" id="navlogo"></a>
</main>
<ul id="navList">
<li><a href="./index">Home</a></li>
<li><a href="about">About Us</a></li>
<li><a href="./index#comm">Community</a></li>
<li><a href="event">Events</a></li>
<li><a href="team">Team</a></li>
<li><a href="./logout">Logout</a></li>
</ul>
</nav>
<h2 id="table-title">Attendees - <?php echo $total_rows; ?></h2>
<a href="exportData.php"><p class="export">Export CSV</p></a>
<div class="table-wrapper">
<table class="fl-table">
<thead>
<tr>
<th>ID</th>
<th>First name</th>
<th>Last name</th>
<th>Email</th>
<th>Phone number</th>
<th>Career</th>
<th>State of Residence</th>
<th>Action</th>
</tr>
</thead>
<tbody>
<?php
while($row = mysqli_fetch_assoc($result)){
echo '
<tr>
<td>'; echo $row['id']; echo '</td>
<td>'; echo $row['firstname']; echo '</td>
<td>'; echo $row['lastname']; echo '</td>
<td>'; echo $row['email']; echo '</td>
<td>'; echo $row['phone']; echo '</td>
<td>'; echo $row['career']; echo '</td>
<td>'; echo $row['state']; echo '</td>
<td><a href="attendees.php?action=delete&&id='; echo $row['id']; echo '"><button name="delete" id="delete">Delete</button></a></td>
</tr>
';
}
?>
<tbody>
</table>
</div>
</body>
</html>