| 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/wcfs/ |
Upload File : |
<!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>
<link rel="stylesheet" href="styles.css">
<script>
function confirmDeletion(postId) {
if (confirm('Are you sure you want to delete this update?')) {
window.location.href = `delete_update.php?id=${postId}`;
}
}
</script>
<style>
.update-item img {
max-width: 100%;
height: auto;
display: block;
margin: 10px auto;
border-radius: 8px;
box-shadow: 0px 4px 6px rgba(0, 0, 0, 0.1);
}
.update-form {
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
padding: 20px;
background-color: #f8f6f1;
border: 1px solid #ccc;
border-radius: 8px;
box-shadow: 0px 4px 6px rgba(0, 0, 0, 0.1);
max-width: 600px;
margin: 20px auto;
}
.update-form .form-group {
width: 100%;
margin-bottom: 15px;
}
.update-form label {
display: block;
font-size: 1.2em;
margin-bottom: 5px;
color: #6f4e37;
}
.update-form input,
.update-form textarea,
.update-form button {
width: 100%;
padding: 10px;
font-size: 1em;
border: 1px solid #ccc;
border-radius: 5px;
}
.update-form textarea {
height: 150px; /* Bigger description box */
resize: vertical;
}
.update-form button {
background-color: #6f4e37;
color: #fff;
cursor: pointer;
border: none;
transition: background-color 0.3s ease;
}
.update-form button:hover {
background-color: #8c6749;
}
</style>
</head>
<body>
<header>
<div class="logo">
<img src="/path-to-logo/Logo.jpg" alt="Wilson Creek Farm Supply Logo">
</div>
<h1>Admin Dashboard</h1>
</header>
<main class="hero">
<h2>Post Updates and Promotions</h2>
<form action="post_update.php" method="POST" enctype="multipart/form-data" class="update-form">
<div class="form-group">
<label for="title">Title:</label>
<input type="text" id="title" name="title" required>
</div>
<div class="form-group">
<label for="description">Description:</label>
<textarea id="description" name="description" required></textarea>
</div>
<div class="form-group">
<label for="image">Upload Image (optional):</label>
<input type="file" id="image" name="image" accept="image/*">
</div>
<button type="submit" class="btn">Post Update</button>
</form>
<h2>Current Updates</h2>
<div class="updates-list">
<?php
// Database connection
$conn = new mysqli("localhost", "nodor", "D@n33Nao40", "wcfs");
// Check connection
if ($conn->connect_error) {
die("Connection failed: " . $conn->connect_error);
}
// Fetch updates from the database
$sql = "SELECT id, title, description, image_path, created_at FROM updates ORDER BY created_at DESC";
$result = $conn->query($sql);
if ($result->num_rows > 0) {
while ($row = $result->fetch_assoc()) {
echo "<div class='update-item'>";
echo "<h3>" . htmlspecialchars($row['title']) . "</h3>";
echo "<p>" . htmlspecialchars($row['description']) . "</p>";
if (!empty($row['image_path'])) {
echo "<img src='" . htmlspecialchars($row['image_path']) . "' alt='Update Image' class='update-image'>";
}
echo "<small>Posted on: " . date("F j, Y, g:i a", strtotime($row['created_at'])) . "</small>";
echo "<button onclick='confirmDeletion(" . $row['id'] . ")' class='btn delete-btn'>Delete</button>";
echo "</div>";
}
} else {
echo "<p>No updates posted yet.</p>";
}
$conn->close();
?>
</div>
</main>
<footer>
<p>© 2025 Wilson Creek Farm Supply. All rights reserved.</p>
</footer>
</body>
</html>