<?php


include("../include/config.php");
include_once("../include/functions/import.php");
verify_login_admin();
        
		
if($_REQUEST['update'] == "success")
{
	$message = "Channel Successfully Edited";
	Stemplate::assign('message',$message);
	STemplate::display("administrator/show_message.tpl");
}
        
if($_REQUEST['edit_channels'])
{
	$name = escape($_REQUEST[name]);
	$details = escape($_REQUEST[message]);	
	$featured = escape($_REQUEST[featured]);
	$CID = escape($_REQUEST[CID]);
	$query = "update channels set
	name = '".mysql_real_escape_string($name)."',
	details = '".mysql_real_escape_string($details)."',
	featured = '".mysql_real_escape_string($featured)."'
	where CID='".mysql_real_escape_string($CID)."'";
	$conn->execute($query);
	header("Location: listchannelsedit.php?update=success&CID=$CID");
}

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

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