<?
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");


$PhpGroup_style['def_style'] = "designs/$style";
$stylepath= $PhpGroup_style['def_style'];
$tpl = new EasyTemplate;
$tpl->Temp = $PhpGroup_style['def_style'];
$tpl->Cache = "easycache";
echo $tpl->display("headerinclude.html");
//start qurey

//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 cat name and the pic
$selectc = mysql_db_query("$dbName", "SELECT * FROM `cat` WHERE `cat_group` = '1' ORDER BY `cat`.`cat_display` ASC  ") ;
while  ($ab = mysql_fetch_array($selectc)){
   $catid = $ab[cat_id];
    $egcount++;
    $row['ac'][] = $ab;
    if ($egcount == 3){
        $rowss[] = $row;
        $egcount=0;
        $row['ac']='';
    }
}
@mysql_free_result($selectc);
if($egcount) $rowss[] = $row;


//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);


//the most divan visted
$selectmostdivan = mysql_db_query("$dbName", "SELECT * FROM `divan` ORDER BY `divan`.`divan_count` DESC LIMIT 0 , 5") ;
while ($mdivan =  @mysql_fetch_array($selectmostdivan)){
$md[] =   $mdivan  ;

 }

//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);










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

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

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