<?php


include("../include/config.php");
include_once("../include/functions/import.php");
verify_login_admin();
        
		
if($_REQUEST['update'] == "success")
{
	$message = "Video Successfully Edited";
	Stemplate::assign('message',$message);
	STemplate::display("administrator/show_message.tpl");
}
        
if($_REQUEST['edit_video'])
{
	$title = escape($_REQUEST[title]);
	$description = escape($_REQUEST[description]);
	$tags = escape($_REQUEST[tags]);	
	$categories = escape($_REQUEST[categories]);	
	$featured = escape($_REQUEST[featured]);	
	$active = escape($_REQUEST[active]);
	$mature = escape($_REQUEST[mature]);
	$VIDEOID = escape($_REQUEST[VIDEOID]);
	
	$query = "update videos set
	title = '".mysql_real_escape_string($title)."',
	description = '".mysql_real_escape_string($description)."',
	tags = '".mysql_real_escape_string($tags)."',
	categories = '".mysql_real_escape_string($categories)."',
	featured = '".mysql_real_escape_string($featured)."',
	active = '".mysql_real_escape_string($active)."',
	mature = '".mysql_real_escape_string($mature)."'
	where VIDEOID='".mysql_real_escape_string($VIDEOID)."'";
	$conn->execute($query);
	header("Location: listvideosedit.php?update=success&VIDEOID=$VIDEOID");
}

if($_REQUEST['VIDEOID']!="")
{
$VIDEOID = escape($_REQUEST[VIDEOID]);
$query = $conn->execute("select * from videos where VIDEOID='".mysql_real_escape_string($VIDEOID)."' limit 1");
$video = $query->getrows();
Stemplate::assign('video', $video[0]);
}

Stemplate::assign('error',$error);
STemplate::display("administrator/listvideosedit.tpl");
?>