<?php
include("connect.php");
include("includes/func_youtube.php");
$folder=$folderyoutube;
$action = $_GET['action'];
if(!isset($action)) $action = "home";

IF ($action=="home"){
$m1=$d9;
$m2=$k9;
tpl_header($LANGAUGE[252]);
bar($namelinks1,$LANGAUGE[252],"","");
table($LANGAUGE[252],youtubecats(),1);
tpl_footer();

}ELSEIF ($action=="cat"){
$id = intval($_GET["id"]);

$sql = @mysql_query("select * from youtubecat where id='$id' AND active='1'");
$Row = @mysql_fetch_array($sql);
if (!$Row)
{
error();
exit;
}
$Row['name_cat'] = text(3,$Row['name_cat']);
$m1 = text(3,$Row['description']);
$m2 = text(3,$Row['keywords']);

tpl_header($Row['name_cat']);
bar($namelinks1,$namelinks13,$Row['name_cat'],"");
table($Row['name_cat'],youtube(),1);
tpl_footer();

}ELSEIF ($action=="show"){

$id = intval($_GET["id"]);
$id = clean_value($id);

$sql = @mysql_query("select * from youtube where id='$id' AND active='1'");
$Row = @mysql_fetch_array($sql);
if (!$Row)
{
error();
exit;
}

$Row['name'] = text(3,$Row['name']);
$Row['code'] = text(3,$Row['code']);
$Row['vis']  = $Row['vis'];
$Row['cat']  = $Row['cat'];
$text = text(2,$Row['text']);
$d = date("j/n/Y",$Row['date']);
$m1 = text(3,$Row['description']);
$m2 = text(3,$Row['keywords']);

$sql2 = @mysql_query("SELECT * FROM youtubecat where id='".$Row['cat']."'") or die ("Query failed3");
$cats = @mysql_fetch_array($sql2);
$cats['name_cat'] = text(3,$cats['name_cat']);
if ($htmlorphp=="1"){
$xxx = "<a href='youtubecat-".$Row['cat'].".html'>".$cats['name_cat']."</a>";
}else{
$xxx = "<a href='youtube.php?action=cat&id=".$Row['cat']."'>".$cats['name_cat']."</a>";
}

$sql3 = @mysql_query("update youtube set vis=vis+1 where id='$id'") or die ("Query failed4");

$F = "<br /><div align='center'>".$LANGAUGE[93]." : ".$Row['vis']." - ".$LANGAUGE[83]." : ".$d."</div>";

tpl_header($Row['name']);
bar($namelinks1,$namelinks13,$xxx,$Row['name']);
table($Row['name'],youtubedisplay($Row['size'],$Row['border'],$Row['related'],$Row['color'],$Row['code']).$F,1);
tpl_footer();
}
?>