Esempio n. 1
0
        $status = intval(trim($_POST['status']));
        if (strlen($title) < 3) {
            $errors[] = 'Game title field cannot be blank!';
        } elseif (strlen($tags) < 3) {
            $errors[] = 'Game keyword(tags) field cannot be blank!';
        } elseif ($category === 0) {
            $errors[] = 'Select at least one category and no more then 3!';
        }
        if (!$errors) {
            if ($_FILES['thumb']['tmp_name'] != '' && is_uploaded_file($_FILES['thumb']['tmp_name'])) {
                require $config['BASE_DIR'] . '/classes/image.class.php';
                $src = $_FILES['thumb']['tmp_name'];
                $dst = $config['BASE_DIR'] . '/media/games/tmb/' . $GID . '.jpg';
                $image = new VImageConv();
                $image->process($src, $dst, 'MAX_WIDTH', 256, 144);
                $image->canvas(256, 144, '000000', true);
            }
            $sql = "UPDATE game SET title = '" . mysql_real_escape_string($title) . "', tags = '" . mysql_real_escape_string($tags) . "',\n                                    category = '" . $category . "', type = '" . mysql_real_escape_string($type) . "',\n                                    be_commented = '" . mysql_real_escape_string($be_commented) . "',\n                                    be_rated = '" . mysql_real_escape_string($be_rated) . "', rate = '" . mysql_real_escape_string($rate) . "',\n                                    ratedby = '" . mysql_real_escape_string($ratedby) . "', total_plays = '" . mysql_real_escape_string($total_plays) . "',\n                                    total_comments = '" . mysql_real_escape_string($total_comments) . "', total_favorites = '" . mysql_real_escape_string($total_favorites) . "',\n                                    status = '" . mysql_real_escape_string($status) . "' WHERE GID = '" . mysql_real_escape_string($GID) . "' LIMIT 1";
            $conn->execute($sql);
            $messages[] = 'Game information updated successfuly!';
        }
    }
    $sql = "SELECT * FROM game WHERE GID = '" . $GID . "' LIMIT 1";
    $rs = $conn->execute($sql);
    if (mysql_affected_rows() == 1) {
        $game = $rs->getrows();
    } else {
        $errors[] = 'Invalid Game ID. This game does not exist!';
    }
}
$sql = "SELECT * FROM game_categories";
Esempio n. 2
0
File: edit.php Progetto: ecr007/pr0n
        $status = intval(trim($_POST['status']));
        if (strlen($title) < 3) {
            $errors[] = 'Game title field cannot be blank!';
        } elseif (strlen($tags) < 3) {
            $errors[] = 'Game keyword(tags) field cannot be blank!';
        } elseif ($category === 0) {
            $errors[] = 'Select at least one category and no more then 3!';
        }
        if (!$errors) {
            if ($_FILES['thumb']['tmp_name'] != '' && is_uploaded_file($_FILES['thumb']['tmp_name'])) {
                require $config['BASE_DIR'] . '/classes/image.class.php';
                $src = $_FILES['thumb']['tmp_name'];
                $dst = $config['BASE_DIR'] . '/media/games/tmb/' . $GID . '.jpg';
                $image = new VImageConv();
                $image->process($src, $dst, 'MAX_WIDTH', 160, 120);
                $image->canvas(160, 120, '000000', true);
            }
            $sql = "UPDATE game SET title = '" . mysql_real_escape_string($title) . "', tags = '" . mysql_real_escape_string($tags) . "',\n                                    category = '" . $category . "', type = '" . mysql_real_escape_string($type) . "',\n                                    be_commented = '" . mysql_real_escape_string($be_commented) . "',\n                                    be_rated = '" . mysql_real_escape_string($be_rated) . "', rate = '" . mysql_real_escape_string($rate) . "',\n                                    ratedby = '" . mysql_real_escape_string($ratedby) . "', total_plays = '" . mysql_real_escape_string($total_plays) . "',\n                                    total_comments = '" . mysql_real_escape_string($total_comments) . "', total_favorites = '" . mysql_real_escape_string($total_favorites) . "',\n                                    status = '" . mysql_real_escape_string($status) . "' WHERE GID = '" . mysql_real_escape_string($GID) . "' LIMIT 1";
            $conn->execute($sql);
            $messages[] = 'Game information updated successfuly!';
        }
    }
    $sql = "SELECT * FROM game WHERE GID = '" . $GID . "' LIMIT 1";
    $rs = $conn->execute($sql);
    if (mysql_affected_rows() == 1) {
        $game = $rs->getrows();
    } else {
        $errors[] = 'Invalid Game ID. This game does not exist!';
    }
}
$sql = "SELECT * FROM game_categories";
Esempio n. 3
0
    } else {
        $sql = "SELECT category_id FROM game_categories\n                       WHERE category_name = '" . mysql_real_escape_string($name) . "' LIMIT 1";
        $conn->execute($sql);
        if ($conn->Affected_Rows() > 0) {
            $errors[] = 'Category name \'' . htmlspecialchars($name, ENT_QUOTES, 'UTF-8') . ' is already used. Please choose another name!';
        } else {
            $channel['name'] = $name;
        }
    }
    if ($_FILES['picture']['tmp_name'] == '') {
        $errors[] = 'Please provide a category image!';
    }
    if (!$errors) {
        $sql = "INSERT INTO game_categories (category_name) VALUES ('" . mysql_real_escape_string($name) . "')";
        $conn->execute($sql);
        $chid = $conn->Insert_ID();
        require $config['BASE_DIR'] . '/classes/image.class.php';
        $image = new VImageConv();
        $image->process($_FILES['picture']['tmp_name'], $chimg . '/' . $chid . '.jpg', 'MAX_WIDTH', 384, 216);
        $image->canvas(384, 216, '000000', true);
        if ($errors) {
            $sql = "DELETE FROM game_categories WHERE category_id = '" . mysql_real_escape_string($chid) . "' LIMIT 1";
            $conn->execute($sql);
        }
    }
    if (!$errors) {
        $msg = 'Category Successfuly added!';
        VRedirect::go('channels.php?m=listgame&msg=' . $msg);
    }
}
$smarty->assign('channel', $channel);
Esempio n. 4
0
    } else {
        $sql = "SELECT category_id FROM game_categories\n                       WHERE category_name = '" . mysql_real_escape_string($name) . "' LIMIT 1";
        $conn->execute($sql);
        if ($conn->Affected_Rows() > 0) {
            $errors[] = 'Category name \'' . htmlspecialchars($name, ENT_QUOTES, 'UTF-8') . ' is already used. Please choose another name!';
        } else {
            $channel['name'] = $name;
        }
    }
    if ($_FILES['picture']['tmp_name'] == '') {
        $errors[] = 'Please provide a category image!';
    }
    if (!$errors) {
        $sql = "INSERT INTO game_categories (category_name) VALUES ('" . mysql_real_escape_string($name) . "')";
        $conn->execute($sql);
        $chid = $conn->Insert_ID();
        require $config['BASE_DIR'] . '/classes/image.class.php';
        $image = new VImageConv();
        $image->process($_FILES['picture']['tmp_name'], $chimg . '/' . $chid . '.jpg', 'MAX_WIDTH', 140, 105);
        $image->canvas(140, 105, '000000', true);
        if ($errors) {
            $sql = "DELETE FROM game_categories WHERE category_id = '" . mysql_real_escape_string($chid) . "' LIMIT 1";
            $conn->execute($sql);
        }
    }
    if (!$errors) {
        $msg = 'Category Successfuly added!';
        VRedirect::go('channels.php?m=listgame&msg=' . $msg);
    }
}
$smarty->assign('channel', $channel);