-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathview_subscribers.php
More file actions
70 lines (62 loc) · 2.13 KB
/
view_subscribers.php
File metadata and controls
70 lines (62 loc) · 2.13 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
<?php
// Simple page to view subscribers
$host = 'localhost';
$username = 'root';
$password = '';
$database = 'skiller_db';
// Create connection
$conn = new mysqli($host, $username, $password, $database);
// Check connection
if ($conn->connect_error) {
die("Connection failed: " . $conn->connect_error);
}
?>
<!DOCTYPE html>
<html>
<head>
<title>View Subscribers</title>
<style>
body { font-family: Arial, sans-serif; padding: 20px; }
table { width: 100%; border-collapse: collapse; margin-top: 20px; }
th, td { padding: 12px; text-align: left; border: 1px solid #ddd; }
th { background-color: #4CAF50; color: white; }
tr:nth-child(even) { background-color: #f2f2f2; }
.empty { text-align: center; padding: 40px; color: #666; }
</style>
</head>
<body>
<h1>Skiller Subscribers</h1>
<?php
// Query to get all subscribers
$sql = "SELECT * FROM subscribers ORDER BY subscription_date DESC";
$result = $conn->query($sql);
if ($result->num_rows > 0) {
echo "<table>";
echo "<tr>
<th>ID</th>
<th>Name</th>
<th>Email</th>
<th>Interest</th>
<th>Date</th>
<th>Status</th>
</tr>";
while($row = $result->fetch_assoc()) {
echo "<tr>";
echo "<td>" . $row['id'] . "</td>";
echo "<td>" . htmlspecialchars($row['name']) . "</td>";
echo "<td>" . htmlspecialchars($row['email']) . "</td>";
echo "<td>" . htmlspecialchars($row['interest']) . "</td>";
echo "<td>" . $row['subscription_date'] . "</td>";
echo "<td>" . ($row['is_active'] ? 'Active' : 'Inactive') . "</td>";
echo "</tr>";
}
echo "</table>";
echo "<p>Total subscribers: " . $result->num_rows . "</p>";
} else {
echo "<div class='empty'>No subscribers found.</div>";
}
$conn->close();
?>
<p><a href="test_submit.html">Back to Test Form</a></p>
</body>
</html>