forked from maiz-an/The-Gallery-Cafe-
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathadmin_view_contacts.php
More file actions
119 lines (107 loc) · 4.32 KB
/
Copy pathadmin_view_contacts.php
File metadata and controls
119 lines (107 loc) · 4.32 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
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
<?php
// Start the session
session_start();
// Check if the user is logged in as admin
if (!isset($_SESSION['username']) || $_SESSION['role'] !== 'admin') {
header("Location: login.html");
exit();
}
// Database connection details
$servername = "localhost";
$username = "root";
$password = "";
$dbname = "product_website";
// Create connection
$conn = new mysqli($servername, $username, $password, $dbname);
// Check connection
if ($conn->connect_error) {
die("Connection failed: " . $conn->connect_error);
}
// Query to select contact form submissions
$sql = "SELECT id, name, email, message, submitted_at FROM contact_submissions ORDER BY submitted_at DESC";
$result = $conn->query($sql);
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Admin - View Contact Submissions</title>
<link rel="stylesheet" href="style/admin_manage_users.css">
<link rel="stylesheet" href="style/admin_view_contacts.css">
<link rel="stylesheet" href="style/h1.css">
<link rel="stylesheet" href="style/footer.css">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.0.0-beta3/css/all.min.css">
<link rel="stylesheet" href="style/floating_contact_button.css">
<script src="js/upbtn.js" defer></script>
</head>
<body>
<header>
<h1>The Gallery Café - Admin</h1>
<div class="header-container">
<div class="title-nav">
<nav>
<ul>
<li><a href="admin_dashboard.php" class="nav-btn">Home</a></li>
<li><a href="admin_modify_user.php" class="nav-btn">Users</a></li>
<li><a href="view_products.php" class="nav-btn">Menu</a></li>
<li><a href="admin_manage_orders.php" class="nav-btn">Orders</a></li>
<li><a href="admin_manage_reservations.php" class="nav-btn">Reservation</a></li>
<li><a href="admin_manage_employee.php" class="nav-btn">Employees</a></li>
<li><a href="admin_view_payments.php" class="nav-btn">Payments</a></li>
<li><a href="admin_view_contacts.php" class="nav-btn" style="color: #ffcc00;">Feedbacks</a></li>
<li><a href="logout.php" class="nav-btn">Logout</a></li>
</ul>
</nav>
</div>
</div>
</header>
<main>
<h2>Contact Form Submissions</h2>
<table>
<tr>
<th>ID</th>
<th>Name</th>
<th>Email</th>
<th>Message</th>
<th>Submitted At</th>
</tr>
<?php
if ($result->num_rows > 0) {
while ($row = $result->fetch_assoc()) {
echo "<tr>";
echo "<td>" . $row['id'] . "</td>";
echo "<td>" . $row['name'] . "</td>";
echo "<td>" . $row['email'] . "</td>";
echo "<td>" . $row['message'] . "</td>";
echo "<td>" . $row['submitted_at'] . "</td>";
echo "</tr>";
}
} else {
echo "<tr><td colspan='5'>No submissions found</td></tr>";
}
// Close the database connection
$conn->close();
?>
</table>
</main>
<footer>
<div class="footer-container">
<div class="social-icons">
<a href="https://facebook.com" target="_blank"><i class="fab fa-facebook-f"></i></a>
<a href="https://twitter.com" target="_blank"><i class="fab fa-twitter"></i></a>
<a href="https://instagram.com" target="_blank"><i class="fab fa-instagram"></i></a>
<a href="https://linkedin.com" target="_blank"><i class="fab fa-linkedin-in"></i></a>
</div>
<p>© 2024 The Gallery Café. All rights reserved.</p>
<p>123 Main Street, Colombo, Sri Lanka | Phone: +94 77 123 4567 | Email: info@gallerycafe.com</p>
</div>
</footer>
</body>
<!-- Scroll to Top Button -->
<div class="scroll-to-top" id="scrollToTop">
<a href="#top" class="scroll-btn">
<i class="fas fa-chevron-up"></i>
</a>
</div>
</html>