<?
ob_start("ob_gzhandler");
include("./includes/config.php");
include("./lang/arabic.php");
include("./includes/function.php");
include("./includes/online.php");
include("./includes/easytemplate.php");
include("./includes/inquiry.php");
include("./includes/bbcode.php");
$PhpGroup_style['def_style'] = "designs/$style";
$stylepath= $PhpGroup_style['def_style'];
$tpl = new EasyTemplate;
$tpl->Temp = $PhpGroup_style['def_style'];
$tpl->Cache = "easycache";

//get the can name in the right page
$selectc = @mysql_db_query("$dbName", "SELECT * FROM `cat`  WHERE `cat_group` = '1' ORDER BY `cat`.`cat_display` ASC  ") ;
while ($s =  @mysql_fetch_assoc($selectc)){
$cat[] =   $s  ;
}
@mysql_free_result($selectc);

//loginbox
loginbox( $login );

//get the last new poem
$selectnewdivan = mysql_db_query("$dbName", "SELECT * FROM `divan`  WHERE `divan_group` = '1' ORDER BY `divan_id` DESC ") ;
while ($ndivan =  @mysql_fetch_assoc($selectnewdivan)){
$nd[] =   $ndivan  ;
}

@mysql_free_result($selectnewdivan);



//statistics
$selectcount= mysql_db_query("$dbName", "SELECT * FROM  cat;") ;
$totalcat = mysql_affected_rows();
@mysql_free_result($selectcount);
$selectcount= mysql_db_query("$dbName", "SELECT * FROM  divan;") ;
$totaldivan = mysql_affected_rows();
@mysql_free_result($selectcount);
$selectcount= mysql_db_query("$dbName", "SELECT * FROM  users;") ;
$totalusers = mysql_affected_rows();
@mysql_free_result($selectcount);

//getcat info

//poeminfo info
$id= trim($_GET['newsid']);
$cleanid = strip_tags($id);
if(! is_numeric($cleanid)) { die("Protected By Tradint"); }
$selectnews = mysql_db_query("$dbName", "SELECT * FROM `news`  WHERE `news_id` = '$cleanid'") ;
while ($ninfo =  @mysql_fetch_assoc($selectnews)){
$newsname= $ninfo[news_title];
$newscontaining= $ninfo[news_value];
$newsdate= $ninfo[news_date];

}

$thisnews =  bbcode($newscontaining);



$subtitle = "&nbsp;&nbsp;&nbsp;-&nbsp;&nbsp;$newsname  ";
  echo $tpl->display("headerinclude.html");

//header
//get the last new poem
$selectnewdivan = mysql_db_query("$dbName", "SELECT * FROM `divan`  WHERE `divan_group` = '1' ORDER BY `divan_id` DESC LIMIT 10 ") ;
while ($ndivan =  @mysql_fetch_assoc($selectnewdivan)){
$nd[] =   $ndivan  ;
}

@mysql_free_result($selectnewdivan);


echo $tpl->display("header.html");


 echo $tpl->display("bodyinclude.html");
 if (($close) == ('yes')){
echo $tpl->display("message.html");
traidntright();
echo $tpl->display("footer.html");
exit();
}


$selectidpoem = mysql_db_query("$dbName", "SELECT * FROM `news`  WHERE `news_id` = '$cleanid'") ;
$totalpoumincat = mysql_affected_rows();
if(($totalpoumincat)==('0')){
$message = $lang[newsnotfound];
echo $tpl->display("message.html");
}else{

$updatcatcount = @mysql_db_query("$dbName", "update `news` SET `news_count` =news_count+1  WHERE `news_id` = '$cleanid' ;  ") ;
//get news
echo "<br>".$tpl->display("viewnews.html");


}



//page footer
echo"<br>";
traidntright();
echo $tpl->display("footer.html");
ob_end_flush();
?>