| Server IP : 173.209.174.21 / Your IP : 216.73.216.89 Web Server : Apache/2.4.58 (Ubuntu) System : Linux wcfs-server 6.8.0-124-generic #124-Ubuntu SMP PREEMPT_DYNAMIC Tue May 26 13:00:45 UTC 2026 x86_64 User : nodor ( 1000) PHP Version : 8.3.6 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : OFF | Sudo : ON | Pkexec : OFF Directory : /var/www/thelittlebigshow/vendor-reg/backup files/ |
Upload File : |
<?php
session_start();
include 'config.php';
$conn = new mysqli(DB_HOST, DB_USER, DB_PASS, DB_NAME);
if ($conn->connect_error) {
die("Connection failed: " . $conn->connect_error);
}
// Fetch vendors from the database
$result = $conn->query("SELECT * FROM vendors");
if (!$result) {
die("Query failed: " . $conn->error);
}
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Admin Dashboard</title>
<style>
body {
font-family: Arial, sans-serif;
background-color: #F7F7F7;
color: #333;
margin: 0;
padding: 0;
}
h2 {
color: #1E90FF;
text-align: center;
margin-top: 30px;
}
.dashboard-container {
width: 80%;
margin: 0 auto;
padding: 20px;
background-color: #fff;
border-radius: 8px;
box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
margin-top: 30px;
}
table {
width: 100%;
border-collapse: collapse;
margin-top: 20px;
}
td, th {
padding: 12px;
text-align: left;
border-bottom: 1px solid #ddd;
word-wrap: break-word; /* Enable word wrapping */
white-space: normal; /* Allow content to break lines and wrap */
}
th {
background-color: #1E90FF;
color: white;
}
tr:nth-child(even) {
background-color: #f9f9f9;
}
.action-buttons {
text-align: center;
}
/* Smaller Buttons */
.action-buttons a {
background-color: #FF4C4C;
color: white;
padding: 5px 10px; /* Reduced padding for smaller buttons */
font-size: 14px; /* Smaller font size */
border-radius: 4px;
text-decoration: none;
font-weight: bold;
transition: background-color 0.3s;
}
.action-buttons a:hover {
background-color: #e03e3e;
}
.edit-button {
background-color: #1E90FF;
color: white;
padding: 5px 10px; /* Reduced padding for smaller buttons */
font-size: 14px; /* Smaller font size */
border-radius: 4px;
text-decoration: none;
font-weight: bold;
}
.edit-button:hover {
background-color: #1c86ee;
}
.back-button {
display: inline-block;
background-color: #1E90FF;
color: white;
padding: 10px 20px;
border-radius: 4px;
text-decoration: none;
margin-bottom: 20px;
}
.back-button:hover {
background-color: #1c86ee;
}
.no-records {
text-align: center;
font-size: 18px;
color: #888;
}
.export-button {
display: inline-block;
background-color: #32CD32;
color: white;
padding: 10px 20px;
border-radius: 4px;
text-decoration: none;
margin-bottom: 20px;
}
.export-button:hover {
background-color: #2e8b57;
}
/* Fix for table alignment */
td, th {
white-space: nowrap; /* Prevent table cells from expanding */
}
/* Column specific styles for Description */
td.description {
max-width: 200px; /* Limit the width of description column */
white-space: normal; /* Allow the description to wrap */
word-wrap: break-word; /* Ensure text breaks within the cell */
}
/* Ensure the action buttons are centered */
.action-buttons {
display: flex;
justify-content: center;
}
/* Ensures the action buttons have consistent width and alignment */
.action-buttons a {
margin-right: 10px;
}
</style>
</head>
<body>
<div class="dashboard-container">
<a href="admin_dashboard.php" class="back-button">Back to Dashboard</a>
<a href="admin_dashboard.php?export=true" class="export-button">Export to CSV</a>
<h2>Registered Vendors</h2>
<?php if ($result->num_rows > 0): ?>
<table>
<tr>
<th>Full Name</th>
<th>Email</th>
<th>Phone</th>
<th>Address</th>
<th>City</th>
<th>State</th>
<th>Zip</th>
<th>Website</th>
<th>Description</th>
<th>Category</th>
<th>Spots</th>
<th>Action</th>
</tr>
<?php while ($row = $result->fetch_assoc()): ?>
<tr>
<td><?php echo htmlspecialchars($row['name']); ?></td>
<td><?php echo htmlspecialchars($row['email']); ?></td>
<td><?php echo htmlspecialchars($row['phone']); ?></td>
<td><?php echo htmlspecialchars($row['address']); ?></td>
<td><?php echo htmlspecialchars($row['city']); ?></td>
<td><?php echo htmlspecialchars($row['state']); ?></td>
<td><?php echo htmlspecialchars($row['zip']); ?></td>
<td><?php echo htmlspecialchars($row['website']); ?></td>
<td class="description"><?php echo htmlspecialchars($row['description']); ?></td>
<td><?php echo htmlspecialchars($row['category']); ?></td>
<td><?php echo htmlspecialchars($row['spots']); ?></td>
<td class="action-buttons">
<a href="delete_vendor.php?id=<?php echo $row['id']; ?>" onclick="return confirm('Are you sure you want to delete this vendor?')">Delete</a>
<a href="edit_vendor.php?id=<?php echo $row['id']; ?>" class="edit-button">Edit</a>
</td>
</tr>
<?php endwhile; ?>
</table>
<?php else: ?>
<div class="no-records">No vendors registered.</div>
<?php endif; ?>
</div>
</body>
</html>