<?php
defined('_VALID') or die('Restricted Access!');

Auth::checkAdmin();

$video  = array();
$GID    = ( isset($_GET['GID']) && is_numeric($_GET['GID']) ) ? intval(trim($_GET['GID'])) : NULL;
if ( !$GID ) {
    $errors[] = 'Invalid game ID. This game does not exist!';
}

if ( !$errors ) {
    if ( isset($_GET['a']) && $_GET['a'] == 'approve' ) {
        $sql = "UPDATE game SET status = '1' WHERE GID = '" .$GID. "' LIMIT 1";
        $conn->execute($sql);
        $msg = 'Game approved successfuly!';
    }

    $sql    = "SELECT g.*, c.name FROM game AS g, channel AS c
               WHERE g.GID = '" .$GID. "' AND c.CHID = g.category LIMIT 1";
    $rs     = $conn->execute($sql);
    if ( mysql_affected_rows() == 1 )
        $game = $rs->getrows();
    else
        $err = 'Invalid game ID. This game does not exist!';
}

$smarty->assign('game', $game);
$smarty->assign('categories', get_categories());
?>
