File "index.php.backup1"

Full Path: /var/www/up.9oko.com/misc/nic/index.php.backup1
File size: 4.06 KB
MIME-type: text/html
Charset: utf-8

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Demo Upload Website</title>
    <style>
        body {
            font-family: 'Courier New', Courier, monospace;
            background-color: #000;
            color: #0f0; /* Green text */
            margin: 0;
        }

        header {
            text-align: center;
            padding: 20px 0;
        }

        h1 {
            margin: 0;
            color: #0f0; /* Green text */
            font-size: 36px;
        }

        section {
            padding: 40px 20px;
        }

        #add-demo, #uploaded-demos {
            background-color: #111;
            margin: 20px;
            border: 1px solid #0f0; /* Green border */
            padding: 20px;
        }

#uploaded-demos ul li a {
    color: yellow; /* Brighter green for the demo names */
}


        h2 {
            color: #0f0; /* Green text */
            font-size: 24px;
        }

        footer {
            text-align: center;
            padding: 20px 0;
            position: fixed;
            bottom: 0;
            width: 100%;
            background-color: #111;
            color: #0f0; /* Green text */
            font-size: 14px;
        }
    </style>
</head>
<body>
    <header>
        <h1>Upload Demo  Website</h1>
    </header>

    <section id="add-demo">
        <h2>Add Demo</h2>
        <?php
        $uploadDir = 'uploads/';

        if(isset($_POST['submit'])) {
            $allowedTypes = ['dm2'];

            $name = htmlspecialchars($_POST['name']);
            $mapName = htmlspecialchars($_POST['map_name']);
            $players = htmlspecialchars($_POST['players']);
            $gameMode = htmlspecialchars($_POST['game_mode']);
            $pov = htmlspecialchars($_POST['pov']);
            $date = htmlspecialchars($_POST['date']);

            $fileName = $_FILES['demo_file']['name'];
            $fileTmp = $_FILES['demo_file']['tmp_name'];
            $fileExt = pathinfo($fileName, PATHINFO_EXTENSION);

            if(in_array($fileExt, $allowedTypes)) {
                $uploadPath = $uploadDir . basename($fileName);

                if(move_uploaded_file($fileTmp, $uploadPath)) {
                    echo "File uploaded successfully.";
                    // Save other form data to a database or perform other necessary operations here
                } else {
                    echo "Error uploading file.";
                }
            } else {
                echo "Invalid file type. Only DM2 files are allowed.";
            }
        }
        ?>

        <form action="" method="post" enctype="multipart/form-data">
            <input type="text" name="name" placeholder="Name of players" required><br>
            <input type="text" name="map_name" placeholder="Map name" required><br>
            <input type="text" name="players" placeholder="1vs1, 2vs2, etc." required><br>
            <input type="text" name="game_mode" placeholder="Game mode" required><br>
            <input type="text" name="pov" placeholder="POV of player" required><br>
            <input type="date" name="date" required><br>
            <input type="file" name="demo_file" accept=".dm2" required><br>
            <input type="submit" name="submit" value="Upload Demo">
        </form>
    </section>

<section id="uploaded-demos">
    <h2>Uploaded Demos</h2>
    <ul>
        <?php
        $files = scandir($uploadDir);
        $id = 1;
        foreach($files as $file) {
            if ($file !== '.' && $file !== '..') {
                $uniqueID = time() + $id;
                echo "<li><strong>Unique ID:</strong> $uniqueID | <strong>Demo Name:</strong> <a href='$uploadDir$file'>$file</a> | <strong>Name of Players:</strong> $name | <strong>Map Name:</strong> $mapName | <strong>Players:</strong> $players | <strong>Game Mode:</strong> $gameMode | <strong>POV:</strong> $pov | <strong>Date:</strong> $date</li>";
                $id++;
            }
        }
        ?>
    </ul>
</section>

    <footer>
        <p>&copy; 2023 Demo upload</p>
    </footer>
</body>
</html>