403Webshell
Server IP : 127.0.0.1  /  Your IP : 216.73.216.48
Web Server : Apache/2.4.58 (Win64) OpenSSL/3.1.3 PHP/8.2.12
System : Windows NT DESKTOP-3H4FHQJ 10.0 build 19045 (Windows 10) AMD64
User : win 10 ( 0)
PHP Version : 8.2.12
Disable Function : NONE
MySQL : OFF |  cURL : ON |  WGET : OFF |  Perl : OFF |  Python : OFF |  Sudo : OFF |  Pkexec : OFF
Directory :  D:/xampp/htdocs-coblaa/Cinevaa/

Upload File :
current_dir [ Writeable] document_root [ Writeable]

 

Command :


[ Back ]     

Current File : D:/xampp/htdocs-coblaa/Cinevaa/edit_movie.php
<?php
include("db.php");
session_start();

if (!isset($_SESSION['my_id'])) {
    header("Location: login.php");
    exit();
}

// 1. Fetch Existing Data
if (isset($_GET['id'])) {
    $id = mysqli_real_escape_string($con, $_GET['id']);
    $res = mysqli_query($con, "SELECT * FROM sn_moviestb WHERE id = '$id'");
    $movie = mysqli_fetch_assoc($res);
    
    if (!$movie) {
        die("Movie not found.");
    }
}

// 2. Handle Update Logic
if (isset($_POST['update_movie'])) {
    $id = mysqli_real_escape_string($con, $_POST['movie_id']);
    $title = mysqli_real_escape_string($con, $_POST['title']);
    $category = mysqli_real_escape_string($con, $_POST['category']);
    $thumbnail_data = $_POST['thumbnail_data'];

    // Update Thumbnail if new one is captured
    if (!empty($thumbnail_data)) {
        // Delete old thumbnail
        @unlink("thumbnail/" . $movie['thumbnail']);
        
        // Save new thumbnail
        $new_thumb_name = time() . '_thumb.jpg';
        list($type, $data) = explode(';', $thumbnail_data);
        list(, $data)      = explode(',', $data);
        $data = base64_decode($data);
        file_put_contents("thumbnail/" . $new_thumb_name, $data);
        
        $update_query = "UPDATE sn_moviestb SET title='$title', movieCategory='$category', thumbnail='$new_thumb_name' WHERE id='$id'";
    } else {
        $update_query = "UPDATE sn_moviestb SET title='$title', movieCategory='$category' WHERE id='$id'";
    }

    if (mysqli_query($con, $update_query)) {
        echo "<script>alert('Movie updated successfully!'); window.location='admin_movie_dash.php';</script>";
    }
}
?>

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Edit Movie | CINEVAA</title>
    <style>
        :root { --gold: #d4af37; --bg: #0a0a0a; --panel: #111; }
        body { background: var(--bg); color: #fff; font-family: 'Segoe UI', sans-serif; padding: 40px; }
        .edit-container { max-width: 700px; margin: 0 auto; background: var(--panel); padding: 30px; border-radius: 12px; border: 1px solid #222; }
        h2 { color: var(--gold); text-transform: uppercase; letter-spacing: 2px; }
        
        .form-group { margin-bottom: 20px; }
        label { display: block; margin-bottom: 8px; color: #888; font-size: 12px; font-weight: bold; }
        input, select { width: 100%; padding: 12px; background: #000; border: 1px solid #333; color: #fff; border-radius: 6px; }
        
        .current-thumb { width: 200px; border-radius: 6px; border: 1px solid var(--gold); margin-bottom: 10px; }
        #video-preview-container { display: none; margin-top: 20px; text-align: center; border-top: 1px solid #333; padding-top: 20px; }
        video { width: 100%; border-radius: 6px; }
        
        .btn-update { background: var(--gold); color: #000; border: none; padding: 15px; width: 100%; border-radius: 6px; font-weight: bold; cursor: pointer; margin-top: 20px; }
        .btn-capture { background: transparent; border: 1px solid var(--gold); color: var(--gold); padding: 10px; cursor: pointer; border-radius: 6px; margin-top: 10px; width: 100%; }
        canvas { display: none; }
    </style>
</head>
<body>

<div class="edit-container">
    <a href="admin_movie_dash.php" style="color: #888; text-decoration: none; font-size: 14px;">← Back to Dashboard</a>
    <h2>Edit Movie Details</h2>

    <form method="POST">
        <input type="hidden" name="movie_id" value="<?php echo $movie['id']; ?>">
        
        <div class="form-group">
            <label>MOVIE TITLE</label>
            <input type="text" name="title" value="<?php echo htmlspecialchars($movie['title']); ?>" required>
        </div>

        <div class="form-group">
            <label>CATEGORY</label>
            <select name="category">
                <?php 
                $genres = ["Action", "Adventure", "Comedy", "Drama", "Horror", "Romance", "Sci-Fi", "Thriller"];
                foreach($genres as $g) {
                    $sel = ($movie['movieCategory'] == $g) ? "selected" : "";
                    echo "<option value='$g' $sel>$g</option>";
                }
                ?>
            </select>
        </div>

        <div class="form-group">
            <label>CURRENT THUMBNAIL</label>
            <img src="thumbnail/<?php echo $movie['thumbnail']; ?>" class="current-thumb">
            <p style="font-size: 11px; color: #666;">To change thumbnail, select the video file again below.</p>
            <input type="file" id="video-updater" accept="video/*">
        </div>

        <div id="video-preview-container">
            <video id="main-video" controls></video>
            <button type="button" class="btn-capture" id="capture-btn">Capture New Frame</button>
            <div style="margin-top:10px;">
                <img id="thumbnail-preview" style="width:200px; display:none; border: 2px solid var(--gold);">
                <input type="hidden" name="thumbnail_data" id="thumbnail_data">
            </div>
        </div>

        <button type="submit" name="update_movie" class="btn-update">SAVE CHANGES</button>
    </form>
</div>

<canvas id="conversion-canvas"></canvas>

<script>
    const videoInput = document.getElementById('video-updater');
    const videoElement = document.getElementById('main-video');
    const previewContainer = document.getElementById('video-preview-container');
    const captureBtn = document.getElementById('capture-btn');
    const thumbnailPreview = document.getElementById('thumbnail-preview');
    const thumbnailDataInput = document.getElementById('thumbnail_data');
    const canvas = document.getElementById('conversion-canvas');

    videoInput.addEventListener('change', function() {
        const file = this.files[0];
        if (file) {
            const url = URL.createObjectURL(file);
            videoElement.src = url;
            previewContainer.style.display = 'block';
        }
    });

    captureBtn.addEventListener('click', function() {
        canvas.width = videoElement.videoWidth;
        canvas.height = videoElement.videoHeight;
        const ctx = canvas.getContext('2d');
        ctx.drawImage(videoElement, 0, 0, canvas.width, canvas.height);
        
        const dataUrl = canvas.toDataURL('image/jpeg', 0.8);
        thumbnailPreview.src = dataUrl;
        thumbnailPreview.style.display = 'inline-block';
        thumbnailDataInput.value = dataUrl;
        captureBtn.innerText = "Frame Captured!";
    });
</script>

</body>
</html>

Youez - 2016 - github.com/yon3zu
LinuXploit