Beispiel #1
0
<?php

require_once "config.php";
require_once WWW_DIR . "/lib/adminpage.php";
require_once WWW_DIR . "/lib/movie.php";
$page = new AdminPage();
$movie = new Movie();
$id = 0;
// set the current action
$action = isset($_REQUEST['action']) ? $_REQUEST['action'] : 'view';
if (isset($_REQUEST["id"])) {
    $id = $_REQUEST["id"];
    $mov = $movie->getMovieInfo($id);
    if (!$mov) {
        $page->show404();
    }
    switch ($action) {
        case 'submit':
            $coverLoc = WWW_DIR . "covers/movies/" . $id . '-cover.jpg';
            $backdropLoc = WWW_DIR . "covers/movies/" . $id . '-backdrop.jpg';
            if ($_FILES['cover']['size'] > 0) {
                $tmpName = $_FILES['cover']['tmp_name'];
                $file_info = getimagesize($tmpName);
                if (!empty($file_info)) {
                    move_uploaded_file($_FILES['cover']['tmp_name'], $coverLoc);
                }
            }
            if ($_FILES['backdrop']['size'] > 0) {
                $tmpName = $_FILES['backdrop']['tmp_name'];
                $file_info = getimagesize($tmpName);
                if (!empty($file_info)) {