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

IF ($action=="home"){
$m1=$d8;
$m2=$k8;
tpl_header($LANGAUGE[58]);
bar($namelinks1,$LANGAUGE[58],"","");
table($LANGAUGE[58],anasheed_cats(),1);
tpl_footer();

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

$sql = @mysql_query("select * from anasheed_cat where id='$id' AND active='1'");
$Row = @mysql_fetch_array($sql);
if (!$Row)
{
error();
exit;
}
$Row['name_cat'] = text(3,$Row['name_cat']);
$Row['text'] = text(3,$Row['text']);
if($Row['text'] == ""){
$b = "";
$ng = 0;
}else{
$b = "<div style='padding-top:7px;'>".nl2br($Row['text'])."</div>";
$ng = 1;
}

$m1 = text(3,$Row['description']);
$m2 = text(3,$Row['keywords']);

tpl_header($Row['name_cat']);
bar($namelinks1,$namelinks8,$Row['name_cat'],"");

table($Row['name_cat'],anasheeds().$b,1);

tpl_footer();

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

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

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

$nameanasheed   = text(3,$Row['name']);
$url            = text(3,$Row['url']);
$vis            = text(3,$Row['vis']);
$cat            = text(3,$Row['cat']);

$m1 = text(3,$Row['metadescription']);
$m2 = text(3,$Row['metakeywords']);

$datex = date("j/n/Y",$Row['date']);

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

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

$F = "<div align='center'>".embed($url,300,60)."</div>";
$F .= "<br />";
$F .= "<div class='info'>
<table class='xtable' width='100%' id='AutoNumber1f5'>
    <tr>
      <td width='30%' class='xtr'>".$LANGAUGE[88]." :</td>
      <td width='70%' class='xtd'><a href='$url'>".$LANGAUGE[89]."</a></td>
    </tr>
    <tr>
      <td width='30%' class='xtr'>".$LANGAUGE[87]." :</td>
      <td width='70%' class='xtd'>$xxx</td>
    </tr>
    <tr>
      <td width='30%' class='xtr'>".$LANGAUGE[84]." :</td>
      <td width='70%' class='xtd'>$vis</td>
    </tr>
    <tr>
      <td width='30%' class='xtr'>".$LANGAUGE[187]."</td>
      <td width='70%' class='xtd'>$datex</td>
    </tr>
  </table>
</div>";

tpl_header($nameanasheed);
bar($namelinks1,$namelinks8,$xxx,$nameanasheed);

table($nameanasheed,$F,1);

tpl_footer();
}
?>