BLACKSITE
:
216.73.217.4
:
104.37.75.190 / alpenpass.ca
:
Linux server3.pointsplan.com 5.14.0-503.38.1.el9_5.x86_64 #1 SMP PREEMPT_DYNAMIC Fri Apr 18 08:52:10 EDT 2025 x86_64
:
/
home
/
apca
/
www
/
admin
/
Upload File:
files >> /home/apca/www/admin/gallery_list.php
<?php session_start(); error_reporting(0); include('includes/config.php'); if(strlen($_SESSION['alogin'])==0) { header('location:index.php'); } else{ if (isset($_GET['action']) && $_GET['action'] === "delete" && isset($_GET['id']) && is_numeric($_GET['id'])) { $id = intval($_GET['id']); // Fetch the image file paths before deleting from the database $stmt = $dbh->prepare("SELECT gallery_url, full_url, video_url FROM gallery WHERE id = :id"); $stmt->bindParam(':id', $id, PDO::PARAM_INT); $stmt->execute(); $image = $stmt->fetch(PDO::FETCH_ASSOC); if ($image) { // Delete the image/video files from the server if (!empty($image['gallery_url']) && file_exists($image['gallery_url'])) { unlink($image['gallery_url']); } if (!empty($image['full_url']) && file_exists($image['full_url'])) { unlink($image['full_url']); } if (!empty($image['video_url']) && file_exists($image['video_url'])) { unlink($image['video_url']); } // Delete the entry from the database $deleteStmt = $dbh->prepare("DELETE FROM gallery WHERE id = :id"); $deleteStmt->bindParam(':id', $id, PDO::PARAM_INT); if ($deleteStmt->execute()) { $message = "Gallery item deleted successfully."; } else { $message = "Error deleting the gallery item."; } } else { $message = "Item not found."; } } // Fetch gallery data $query = "SELECT id, gallery_url, title, caption, category, type, tags, sort_order FROM gallery ORDER BY sort_order ASC, uploaded_at DESC"; $stmt = $dbh->prepare($query); $stmt->execute(); $results = $stmt->fetchAll(PDO::FETCH_ASSOC); ?> <!doctype html> <html lang="en" class="no-js"> <head> <meta charset="UTF-8"> <meta http-equiv="X-UA-Compatible" content="IE=edge"> <meta name="viewport" content="width=device-width, initial-scale=1, minimum-scale=1, maximum-scale=1"> <meta name="description" content=""> <meta name="author" content=""> <meta name="theme-color" content="#3e454c"> <title>Alpenpass Motorcycle Rental Portal | Admin Gallery List</title> <!-- Font awesome --> <link rel="stylesheet" href="css/font-awesome.min.css"> <!-- Sandstone Bootstrap CSS --> <link rel="stylesheet" href="css/bootstrap.min.css"> <!-- Bootstrap Datatables --> <link rel="stylesheet" href="css/dataTables.bootstrap.min.css"> <!-- Bootstrap social button library --> <link rel="stylesheet" href="css/bootstrap-social.css"> <!-- Bootstrap select --> <link rel="stylesheet" href="css/bootstrap-select.css"> <!-- Bootstrap file input --> <link rel="stylesheet" href="css/fileinput.min.css"> <!-- Awesome Bootstrap checkbox --> <link rel="stylesheet" href="css/awesome-bootstrap-checkbox.css"> <!-- Admin Stye --> <link rel="stylesheet" href="css/style.css"> <style> .errorWrap { padding: 10px; margin: 0 0 20px 0; background: #fff; border-left: 4px solid #dd3d36; -webkit-box-shadow: 0 1px 1px 0 rgba(0,0,0,.1); box-shadow: 0 1px 1px 0 rgba(0,0,0,.1); } .succWrap{ padding: 10px; margin: 0 0 20px 0; background: #fff; border-left: 4px solid #5cb85c; -webkit-box-shadow: 0 1px 1px 0 rgba(0,0,0,.1); box-shadow: 0 1px 1px 0 rgba(0,0,0,.1); } </style> </head> <body> <?php include('includes/header.php');?> <div class="ts-main-content"> <?php include('includes/leftbar.php');?> <div class="content-wrapper"> <div class="container-fluid"> <div class="row"> <div class="col-md-12"> <h2 class="page-title">Gallery List</h2> <div class="row"> <div class="col-md-10"> <div class="panel panel-default"> <div class="panel-heading">Gallery List</div> <div class="panel-body"> <form method="post" name="chngpwd" class="form-horizontal" onSubmit="return valid();"> <?php if($error){?><div class="errorWrap"><strong>ERROR</strong>:<?php echo htmlentities($error); ?> </div><?php } else if($msg){?><div class="succWrap"><strong>SUCCESS</strong>:<?php echo htmlentities($msg); ?> </div><?php }?> <!-- DataTables CSS --> <link rel="stylesheet" href="https://cdn.datatables.net/1.13.6/css/jquery.dataTables.min.css"> <link rel="stylesheet" href="https://cdn.datatables.net/buttons/2.3.6/css/buttons.dataTables.min.css"> <!-- Bootstrap CSS (Optional for styling) --> <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/bootstrap/5.3.0/css/bootstrap.min.css"> <!-- FontAwesome for icons --> <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.2/css/all.min.css"> <style> .img-thumbnail { width: 90px; height: auto; } .action-icons { display: flex; gap: 10px; justify-content: center; } </style> </head> <body> <div class="container mt-4"> <h2 class="mb-3">Gallery List</h2> <?php if($message){?> <div style="width:100%; text-align: center; padding: 20px;background-color: #CCFFCC; border-radius: 20px; border: thin solid #339966; margin-bottom:20px;"><?php echo $message?></div> <?php } ?> <table id="galleryTable" class="display nowrap table table-striped table-bordered" style="width:100%"> <thead> <tr> <th>Image</th> <th>Title</th> <th>Caption</th> <th>Category</th> <th>Type</th> <th>Tags</th> <th>Sort Order</th> <th>Action</th> </tr> </thead> <tbody> <?php foreach ($results as $row): ?> <tr> <td><img src="../<?php echo htmlentities($row['gallery_url']); ?>" class="img-thumbnail"></td> <td><?php echo htmlentities($row['title']); ?></td> <td><?php echo htmlentities(substr($row['caption'], 0, 40)); ?></td> <td><?php echo htmlentities($row['category']); ?></td> <td><?php echo htmlentities($row['type']); ?></td> <td><?php echo htmlentities($row['tags']); ?></td> <td><?php echo htmlentities($row['sort_order']); ?></td> <td class="action-icons"> <a href="gallery_uploads.php?action=edit&id=<?php echo $row['id']; ?>" class="text-primary" title="Edit Image"> <i class="fa fa-edit"></i> </a> <a href="gallery_list.php?action=delete&id=<?php echo $row['id']; ?>" class="text-danger" onclick="return confirm('Are you sure you want to delete this item?');" title="Delete Image"> <i class="fa fa-trash"></i> </a> </td> </tr> <?php endforeach; ?> </tbody> </table> </div> </div> </div> </div> </div> </div> </div> </div> </div> </div> <!-- jQuery & DataTables --> <script src="https://code.jquery.com/jquery-3.6.0.min.js"></script> <script src="https://cdn.datatables.net/1.13.6/js/jquery.dataTables.min.js"></script> <script src="https://cdn.datatables.net/buttons/2.3.6/js/dataTables.buttons.min.js"></script> <script src="https://cdn.datatables.net/buttons/2.3.6/js/buttons.html5.min.js"></script> <script src="js/main.js"></script> <script> $(document).ready(function() { $('#galleryTable').DataTable({ responsive: true, lengthMenu: [[10, 25, 50, -1], [10, 25, 50, "All"]], columnDefs: [{ orderable: false, targets: [0, 7] }], order: [[6, 'asc']] }); }); </script> </body> </html> <?php } ?>