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/upload_media.php
<?php include('includes/config.php'); if ($_SERVER['REQUEST_METHOD'] === 'POST') { $title = $_POST['title']; $caption = $_POST['caption']; $type = $_POST['type']; $file = $_FILES['file']; // Determine the category if ($_POST['category'] === 'new' && !empty($_POST['new_category'])) { $category = $_POST['new_category']; } else { $category = $_POST['category']; } if (empty($category)) { echo "Error: Category is required."; exit; } // Ensure required directories exist $galleryDir = "admin/uploads/gallery/"; $fullDir = "admin/uploads/full/"; $videoDir = "admin/uploads/videos/"; if (!file_exists($galleryDir)) mkdir($galleryDir, 0777, true); if (!file_exists($fullDir)) mkdir($fullDir, 0777, true); if (!file_exists($videoDir)) mkdir($videoDir, 0777, true); if ($file['error'] === UPLOAD_ERR_OK) { $ext = pathinfo($file['name'], PATHINFO_EXTENSION); $fileName = uniqid() . '.' . $ext; if ($type === 'image') { $galleryPath = $galleryDir . $fileName; $fullPath = $fullDir . $fileName; move_uploaded_file($file['tmp_name'], $fullPath); // Resize image for gallery $img = imagecreatefromstring(file_get_contents($fullPath)); $galleryImg = imagescale($img, 600); imagejpeg($galleryImg, $galleryPath); imagedestroy($img); imagedestroy($galleryImg); $stmt = $dbh->prepare("INSERT INTO gallery (title, caption, category, type, gallery_url, full_url) VALUES (:title, :caption, :category, :type, :gallery_url, :full_url)"); $stmt->execute([ ':title' => $title, ':caption' => $caption, ':category' => $category, ':type' => $type, ':gallery_url' => $galleryPath, ':full_url' => $fullPath, ]); } elseif ($type === 'video') { $videoPath = $videoDir . $fileName; move_uploaded_file($file['tmp_name'], $videoPath); $stmt = $dbh->prepare("INSERT INTO gallery (title, caption, category, type, gallery_url, video_url) VALUES (:title, :caption, :category, :type, :gallery_url, :video_url)"); $stmt->execute([ ':title' => $title, ':caption' => $caption, ':category' => $category, ':type' => $type, ':gallery_url' => $videoPath, ':video_url' => $videoPath, ]); } } else { echo "Error uploading file."; } header('Location: admin_gallery.php'); exit; } ?>