72 lines
1.6 KiB
PHP
Executable File
72 lines
1.6 KiB
PHP
Executable File
<?php
|
|
|
|
session_start();
|
|
|
|
if (!isset($_SESSION['uid'])) {
|
|
header('Location: /admin/login.php');
|
|
die;
|
|
}
|
|
|
|
$conn = new mysqli("localhost", "mileslinden", "Daiso@6969", "mileslinden");
|
|
|
|
$result = $conn->query("SELECT * FROM subscribers");
|
|
if (!$result) {
|
|
http_response_code(500);
|
|
die("Error: {$conn->error}");
|
|
}
|
|
|
|
$subscribers = [];
|
|
while ($row = $result->fetch_assoc()) {
|
|
$subscribers[] = $row;
|
|
}
|
|
?>
|
|
<!DOCTYPE HTML>
|
|
<html lang="en">
|
|
<head>
|
|
<meta charset="utf-8">
|
|
<title>Miles Linden for San Jose City Council</title>
|
|
</head>
|
|
<body>
|
|
<h1>Admin Panel</h1>
|
|
<div>
|
|
<p><a href="logout.php">Logout</a></p>
|
|
<p><a href="mail.php">Mail All</a></p>
|
|
</div>
|
|
<h2>Subscribers</h2>
|
|
<table cellpadding="5">
|
|
<thead>
|
|
<tr>
|
|
<th>Name</th>
|
|
<th>Email</th>
|
|
<th>Phone</th>
|
|
<!--<th>Gender</th>-->
|
|
<th>Join Date</th>
|
|
<th>Actions</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody>
|
|
<?php
|
|
foreach ($subscribers as $row) {
|
|
?>
|
|
<tr>
|
|
<td><?= htmlspecialchars($row['full_name']) ?></td>
|
|
<td>
|
|
<a href="mailto:<?= htmlspecialchars($row['email']) ?>"><?= htmlspecialchars($row['email']) ?></a></td>
|
|
<td><?= htmlspecialchars($row['phone']) ?></td>
|
|
<!--<td><?= htmlspecialchars($row['gender']) ?></td>-->
|
|
<td><?= htmlspecialchars($row['join_date']) ?></td>
|
|
<td>
|
|
<form action="/admin/unsubscribe.php" method="POST">
|
|
<input type="hidden" name="email" value="<?= htmlspecialchars($row['email']) ?>">
|
|
<button type="submit">Delete</button>
|
|
</form>
|
|
</td>
|
|
</tr>
|
|
<?php
|
|
}
|
|
?>
|
|
</tbody>
|
|
</table>
|
|
</body>
|
|
</html>
|