D7net
Home
Console
Upload
information
Create File
Create Folder
About
Tools
:
/
home3
/
encodto1
/
public_html
/
encoadminders
/
Filename :
logo.php
back
Copy
<?php session_start(); include 'config.php'; if (!isset($_SESSION['admin_name'])) { echo '<script>window.location.href = "login.php";</script>'; exit; } // Handle delete request if (isset($_GET['delete_id'])) { $delete_id = intval($_GET['delete_id']); $query = "SELECT image FROM logos WHERE logo_id = $delete_id"; $result = mysqli_query($conn, $query); if ($result && mysqli_num_rows($result) > 0) { $row = mysqli_fetch_assoc($result); $imagePath = 'uploads/logos/' . $row['image']; if (file_exists($imagePath)) { unlink($imagePath); } $deleteQuery = "DELETE FROM logos WHERE logo_id = $delete_id"; if (mysqli_query($conn, $deleteQuery)) { echo '<script>alert("Logo deleted successfully!"); window.location.href = "logo.php";</script>'; } else { echo '<script>alert("Error deleting logo!");</script>'; } } } // Fetch logos from the database $query = "SELECT * FROM logos ORDER BY created_at DESC"; $result = mysqli_query($conn, $query); ?> <!DOCTYPE html> <html lang="en"> <head> <title>Logo Management</title> <?php include('style.php') ?> <style> :root { --primary-color: #007bff; --secondary-color: #333; --accent-color: #28a745; --danger-color: #dc3545; --background-color: #f9f9f9; --card-border: #ddd; --font-family: 'Poppins', sans-serif; } body { font-family: var(--font-family); background-color: #fff; margin: 0; padding: 0; color: var(--secondary-color); } .logo-list-container { max-width: 1200px; margin: 0 auto; background: #fff; padding: 20px; box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1); border-radius: 10px; } h2 { font-size: 28px; color: var(--primary-color); font-weight: bold; } .btn-add { padding: 9px 20px; background-color: var(--primary-color); color: #fff; text-decoration: none; border-radius: 5px; font-size: 14px; transition: background 0.3s ease; } .btn-add:hover { background-color: #0056b3; } .gallery-list { display: flex; flex-direction: column; gap: 30px; } .gallery-item { display: flex; flex-wrap: wrap; gap: 20px; border: 1px solid var(--card-border); border-radius: 10px; padding: 20px; background-color: var(--background-color); box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1); transition: transform 0.3s ease, box-shadow 0.3s ease; } .gallery-item:hover { transform: translateY(-5px); box-shadow: 0 6px 15px rgba(0, 0, 0, 0.15); } .gallery-image-col { flex: 0 0 33.33%; display: flex; justify-content: center; align-items: center; background: #fff; padding: 10px; border-radius: 10px; } .gallery-image { max-width: 100%; height: auto; border-radius: 8px; box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2); } .gallery-info-col { flex: 0 0 50%; display: flex; flex-direction: column; gap: 15px; padding: 10px; } .field { display: flex; flex-direction: column; gap: 10px; border: 1px solid var(--card-border); border-radius: 10px; padding: 15px; background-color: var(--background-color); box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1); } .field h4 { font-size: 16px; color: var(--primary-color); margin-bottom: 5px; } .field p { font-size: 14px; color: var(--secondary-color); word-wrap: break-word; margin: 0; } .actions { display: flex; gap: 15px; margin-top: 10px; } .actions a { padding: 8px 15px; font-size: 14px; color: #fff; text-decoration: none; border-radius: 5px; transition: background 0.3s ease; } .actions .edit { background-color: var(--accent-color); } .actions .edit:hover { background-color: #218838; } .actions .delete { background-color: var(--danger-color); } .actions .delete:hover { background-color: #c82333; } @media (max-width: 768px) { .gallery-item { flex-direction: column; } .gallery-image-col, .gallery-info-col { flex: 1 1 100%; } .actions a { width: 100%; font-size: 12px; padding: 10px 15px; text-align: center; } } </style> </head> <body> <?php include('sidebar.php') ?> <div class="home-section"> <div class="logo-list-container"> <h2>Uploaded Logos</h2> <div class="gallery-list"> <?php while ($row = mysqli_fetch_assoc($result)) : ?> <div class="gallery-item"> <div class="gallery-image-col"> <img src="uploads/logos/<?php echo htmlspecialchars($row['image']); ?>" alt="Logo Image" class="gallery-image"> </div> <div class="gallery-info-col"> <div class="field"> <h4>ID:</h4> <p><?php echo htmlspecialchars($row['logo_id']); ?></p> </div> <div class="field"> <h4>Title:</h4> <p><?php echo htmlspecialchars($row['title']); ?></p> </div> <div class="field"> <h4>Created At:</h4> <p><?php echo htmlspecialchars($row['created_at']); ?></p> </div> <div class="actions"> <a href="edit_logo.php?id=<?php echo $row['logo_id']; ?>" class="actions edit">Edit</a> <a href="?delete_id=<?php echo $row['logo_id']; ?>" class="actions delete" onclick="return confirm('Are you sure you want to delete this logo?');">Delete</a> </div> </div> </div> <?php endwhile; ?> </div> </div> </div> <?php include('footer.php') ?> </body> </html>