<?php
include('header.php');
echo $h;

$sql0 = @mysql_query("SELECT id FROM fatawa_cat");
$num_ftawacat = mysql_num_rows($sql0);

$sql1 = @mysql_query("SELECT id FROM fatawa");
$num_ftawa = mysql_num_rows($sql1);

$sql2 = @mysql_query("SELECT id FROM flash_cat");
$num_flashcat = mysql_num_rows($sql2);

$sql3 = @mysql_query("SELECT id FROM flash");
$num_flash = mysql_num_rows($sql3);

$sql4 = @mysql_query("SELECT id FROM signatures_cat");
$num_signaturescat = mysql_num_rows($sql4);

$sql5 = @mysql_query("SELECT id FROM signatures");
$num_signatures = mysql_num_rows($sql5);

$sql6 = @mysql_query("SELECT id FROM anasheed_cat");
$num_anasheedcat = mysql_num_rows($sql6);

$sql7 = @mysql_query("SELECT id FROM anasheed");
$num_anasheed = mysql_num_rows($sql7);

$sql8 = @mysql_query("SELECT id FROM news_cat");
$num_newscat = mysql_num_rows($sql8);

$sql9 = @mysql_query("SELECT id FROM news");
$num_news = mysql_num_rows($sql9);

$sql10 = @mysql_query("SELECT id FROM dlil_cat");
$num_dlilcat = mysql_num_rows($sql10);

$sql11 = @mysql_query("SELECT id FROM islam_dlil");
$num_dlil = mysql_num_rows($sql11);

$sql12 = @mysql_query("SELECT id FROM telawat_cat");
$num_telawatcat = mysql_num_rows($sql12);

$sql13 = @mysql_query("SELECT id FROM telawat");
$num_telawat = mysql_num_rows($sql13);

$sql14 = @mysql_query("SELECT id FROM mhadrat_cat");
$num_mhadratcat = mysql_num_rows($sql14);

$sql15 = @mysql_query("SELECT id FROM mhadrat");
$num_mhadrat = mysql_num_rows($sql15);

$sql16 = @mysql_query("SELECT id FROM book_cat");
$num_bookcat = mysql_num_rows($sql16);

$sql17 = @mysql_query("SELECT id FROM book_all");
$num_book = mysql_num_rows($sql17);

$sql18 = @mysql_query("SELECT id FROM sjl_alzwar where active=0");
$num_sjl_alzwar = mysql_num_rows($sql18);

$sql18dd = @mysql_query("SELECT id FROM sjl_alzwar where active=1");
$num_sjl_alzward = mysql_num_rows($sql18dd);

$sql19 = @mysql_query("SELECT id FROM pages");
$num_pages = mysql_num_rows($sql19);

$sql20 = @mysql_query("SELECT id FROM pool");
$num_poll = mysql_num_rows($sql20);

$sql21 = @mysql_query("SELECT id FROM youtubecat");
$num_youtubecat = mysql_num_rows($sql21);

$sql22 = @mysql_query("SELECT id FROM youtube");
$num_youtube = mysql_num_rows($sql22);

$result = mysql_query("SELECT * from counter") or die("Invalid query: " . mysql_error());
$row = mysql_fetch_array($result);
$total = $row['total'] ;

$OnlineUsers = mysql_query("select * from online");
$online = mysql_num_rows($OnlineUsers);

$resultr = mysql_query("SELECT * from xcounter");
$rowr = mysql_fetch_array($resultr);

$Htoday = $rowr['today'] ;
$Hmonth = $rowr['thismonth'] ;
$Hyear  = $rowr['thisyear'] ;
$Htotal = $rowr['total'] ;

$sd1 = mysql_num_rows(mysql_query("select * from download_cat"));
$sd2 = mysql_num_rows(mysql_query("select * from download"));
$sd3 = mysql_num_rows(mysql_query("select * from story_cat"));
$sd4 = mysql_num_rows(mysql_query("select * from story"));
$sd5 = mysql_num_rows(mysql_query("select * from msg_box where showadmin=0"));
$sd6 = mysql_num_rows(mysql_query("select * from pathstyle"));
$sd7 = mysql_num_rows(mysql_query("select * from msg_box"));

$sd2221 = mysql_num_rows(mysql_query("select * from text_cat"));
$sd2222 = mysql_num_rows(mysql_query("select * from text"));

$q1 = mysql_query(" select sum(vis) from anasheed") or die (mysql_error());
$r1 = mysql_fetch_array($q1);
$s1 = $r1["0"];

$q2 = mysql_query(" select sum(vis) from book_all") or die (mysql_error());
$r2 = mysql_fetch_array($q2);
$s2 = $r2["0"];

$q3 = mysql_query(" select sum(vis) from book_cat") or die (mysql_error());
$r3 = mysql_fetch_array($q3);
$s3 = $r3["0"];

$q4 = mysql_query(" select sum(vis) from fatawa") or die (mysql_error());
$r4 = mysql_fetch_array($q4);
$s4 = $r4["0"];

$q5 = mysql_query(" select sum(vis) from flash") or die (mysql_error());
$r5 = mysql_fetch_array($q5);
$s5 = $r5["0"];

$q6 = mysql_query(" select sum(vis) from islam_dlil") or die (mysql_error());
$r6 = mysql_fetch_array($q6);
$s6 = $r6["0"];

$q7 = mysql_query(" select sum(vis) from mhadrat") or die (mysql_error());
$r7 = mysql_fetch_array($q7);
$s7 = $r7["0"];

$q8 = mysql_query(" select sum(vis) from news") or die (mysql_error());
$r8 = mysql_fetch_array($q8);
$s8 = $r8["0"];

$q9 = mysql_query(" select sum(vis) from pages") or die (mysql_error());
$r9 = mysql_fetch_array($q9);
$s9 = $r9["0"];

$q10 = mysql_query(" select sum(vis) from telawat") or die (mysql_error());
$r10 = mysql_fetch_array($q10);
$s10 = $r10["0"];

$q101 = mysql_query(" select sum(vis) from youtube") or die (mysql_error());
$r101 = mysql_fetch_array($q101);
$s101 = $r101["0"];

$www = "40%";
$hhh = "10%";

$www1 = "40%";
$hhh1 = "10%";

$lang_menu12 = "&nbsp;<font color='#FF0000'>»</font>";

echo "<table class='xtable' width='100%' id='Aut46oNumber1'>

<tr>
<td width='100%' colspan='4' class='xtx' align='center'>".$LANGAUGE_CP[438]."</td>
</tr>

<tr>
<td width='100%' colspan='4' class='xtr' align='center'>
".$LANGAUGE_CP[439]." <u>$u</u> ".$LANGAUGE_CP[440]."</td>
</tr>

<tr>
<td width='$www' class='xtr'>$lang_menu12 ".$LANGAUGE_CP[441]."</td>
<td width='$hhh' class='xtd' align='center'>$online</td>
<td width='$www1' class='xtr'>$lang_menu12 ".$LANGAUGE_CP[442]."</td>
<td width='$hhh1' class='xtd' align='center'>$Htotal</td>
</tr>

<tr>
<td width='$www' class='xtr'>$lang_menu12 ".$LANGAUGE_CP[443]."</td>
<td width='$hhh' class='xtd' align='center'>$Htoday</td>
<td width='$www1' class='xtr'>$lang_menu12 ".$LANGAUGE_CP[444]."</td>
<td width='$hhh1' class='xtd' align='center'>$Hmonth</td>
</tr>

<tr>
<td width='$www' class='xtr'>$lang_menu12 ".$LANGAUGE_CP[445]."</td>
<td width='$hhh' class='xtd' align='center'>$sd5</td>
<td width='$www1' class='xtr'>$lang_menu12 ".$LANGAUGE_CP[446]."</td>
<td width='$hhh1' class='xtd' align='center'>$sd7</td>
</tr>

<tr>
<td width='$www' class='xtr'>$lang_menu12 ".$LANGAUGE_CP[447]."</td>
<td width='$hhh' class='xtd' align='center'>$sd6</td>
<td width='$www1' class='xtr'>$lang_menu12 $lang_t139 ".$LANGAUGE_CP[448]."</td>
<td width='$hhh1' class='xtd' align='center'>$num_poll</td>
</tr>

<tr>
<td width='$www' class='xtr'>$lang_menu12 $lang_t139 ".$LANGAUGE_CP[449]."</td>
<td width='$hhh' class='xtd' align='center'>$num_sjl_alzward</td>
<td width='$www1' class='xtr'>$lang_menu12 $lang_t139 ".$LANGAUGE_CP[450]."</td>
<td width='$hhh1' class='xtd' align='center'>$num_sjl_alzwar</td>
</tr>

<tr>
<td width='100%' colspan='4' class='xtd' align='center'>- - - - - - - - - - - - - - - - - - - - - - - - - - - -</td>
</tr>

<tr>
<td width='$www' class='xtr'>$lang_menu12 ".$LANGAUGE_CP[451]."</td>
<td width='$hhh' class='xtd' align='center'>$num_newscat</td>
<td width='$www1' class='xtr'>$lang_menu12 ".$LANGAUGE_CP[452]."</td>
<td width='$hhh1' class='xtd' align='center'>$num_news</td>
</tr>

<tr>
<td width='$www' class='xtr'>$lang_menu12 ".$LANGAUGE_CP[453]."</td>
<td width='$hhh' class='xtd' align='center'>$num_telawatcat</td>
<td width='$www1' class='xtr'>$lang_menu12 ".$LANGAUGE_CP[454]."</td>
<td width='$hhh1' class='xtd' align='center'>$num_telawat</td>
</tr>

<tr>
<td width='$www' class='xtr'>$lang_menu12 ".$LANGAUGE_CP[455]."</td>
<td width='$hhh' class='xtd' align='center'>$num_mhadratcat</td>
<td width='$www1' class='xtr'>$lang_menu12 ".$LANGAUGE_CP[456]."</td>
<td width='$hhh1' class='xtd' align='center'>$num_mhadrat</td>
</tr>

<tr>
<td width='$www' class='xtr'>$lang_menu12 ".$LANGAUGE_CP[457]."</td>
<td width='$hhh' class='xtd' align='center'>$num_ftawacat</td>
<td width='$www1' class='xtr'>$lang_menu12 ".$LANGAUGE_CP[458]."</td>
<td width='$hhh1' class='xtd' align='center'>$num_ftawa</td>
</tr>

<tr>
<td width='$www' class='xtr'>$lang_menu12 ".$LANGAUGE_CP[459]."</td>
<td width='$hhh' class='xtd' align='center'>$num_bookcat</td>
<td width='$www1' class='xtr'>$lang_menu12 ".$LANGAUGE_CP[460]."</td>
<td width='$hhh1' class='xtd' align='center'>$num_book</td>
</tr>

<tr>
<td width='$www' class='xtr'>$lang_menu12 ".$LANGAUGE_CP[461]."</td>
<td width='$hhh' class='xtd' align='center'>$num_anasheedcat</td>
<td width='$www1' class='xtr'>$lang_menu12 ".$LANGAUGE_CP[462]."</td>
<td width='$hhh1' class='xtd' align='center'>$num_anasheed</td>
</tr>

<tr>
<td width='$www' class='xtr'>$lang_menu12 ".$LANGAUGE_CP[463]."</td>
<td width='$hhh' class='xtd' align='center'>$sd3</td>
<td width='$www1' class='xtr'>$lang_menu12 ".$LANGAUGE_CP[464]."</td>
<td width='$hhh1' class='xtd' align='center'>$sd4</td>
</tr>


<tr>
<td width='$www' class='xtr'>$lang_menu12 ".$LANGAUGE_CP[465]."</td>
<td width='$hhh' class='xtd' align='center'>$num_flashcat</td>
<td width='$www1' class='xtr'>$lang_menu12 ".$LANGAUGE_CP[466]."</td>
<td width='$hhh1' class='xtd' align='center'>$num_flash</td>
</tr>

<tr>
<td width='$www' class='xtr'>$lang_menu12 ".$LANGAUGE_CP[467]."</td>
<td width='$hhh' class='xtd' align='center'>$num_signaturescat</td>
<td width='$www1' class='xtr'>$lang_menu12 ".$LANGAUGE_CP[468]."</td>
<td width='$hhh1' class='xtd' align='center'>$num_signatures</td>
</tr>

<tr>
<td width='$www' class='xtr'>$lang_menu12 ".$LANGAUGE_CP[469]."</td>
<td width='$hhh' class='xtd' align='center'>$sd1</td>
<td width='$www1' class='xtr'>$lang_menu12 ".$LANGAUGE_CP[470]."</td>
<td width='$hhh1' class='xtd' align='center'>$sd2</td>
</tr>

<tr>
<td width='$www' class='xtr'>$lang_menu12 ".$LANGAUGE_CP[471]."</td>
<td width='$hhh' class='xtd' align='center'>$num_dlilcat</td>
<td width='$www1' class='xtr'>$lang_menu12 ".$LANGAUGE_CP[472]."</td>
<td width='$hhh1' class='xtd' align='center'>$num_dlil</td>
</tr>

<tr>
<td width='$www' class='xtr'>$lang_menu12 ".$LANGAUGE_CP[473]."</td>
<td width='$hhh' class='xtd' align='center'>$num_youtubecat</td>
<td width='$www1' class='xtr'>$lang_menu12 ".$LANGAUGE_CP[474]."</td>
<td width='$hhh1' class='xtd' align='center'>$num_youtube</td>
</tr>

<tr>
<td width='$www' class='xtr'>$lang_menu12 ".$LANGAUGE_CP[704]."</td>
<td width='$hhh' class='xtd' align='center'>$sd2221</td>
<td width='$www1' class='xtr'>$lang_menu12 ".$LANGAUGE_CP[705]."</td>
<td width='$hhh1' class='xtd' align='center'>$sd2222</td>
</tr>

<tr>
<td width='100%' colspan='4' class='xtd' align='center'>- - - - - - - - - - - - - - - - - - - - - - - - - - - -</td>
</tr>

<tr>
<td width='$www' class='xtr'>$lang_menu12 ".$LANGAUGE_CP[475]."</td>
<td width='$hhh' class='xtd' align='center'>$s2</td>
<td width='$www1' class='xtr'>$lang_menu12 ".$LANGAUGE_CP[476]."</td>
<td width='$hhh1' class='xtd' align='center'>$s3</td>
</tr>


<tr>
<td width='$www' class='xtr'>$lang_menu12 ".$LANGAUGE_CP[477]."</td>
<td width='$hhh' class='xtd' align='center'>$s4</td>
<td width='$www1' class='xtr'>$lang_menu12 ".$LANGAUGE_CP[478]."</td>
<td width='$hhh1' class='xtd' align='center'>$s5</td>
</tr>

<tr>
<td width='$www' class='xtr'>$lang_menu12 ".$LANGAUGE_CP[479]."</td>
<td width='$hhh' class='xtd' align='center'>$s6</td>
<td width='$www1' class='xtr'>$lang_menu12 ".$LANGAUGE_CP[480]."</td>
<td width='$hhh1' class='xtd' align='center'>$s7</td>
</tr>

<tr>
<td width='$www' class='xtr'>$lang_menu12 ".$LANGAUGE_CP[481]."</td>
<td width='$hhh' class='xtd' align='center'>$s8</td>
<td width='$www1' class='xtr'>$lang_menu12 ".$LANGAUGE_CP[482]."</td>
<td width='$hhh1' class='xtd' align='center'>$s10</td>
</tr>

<tr>
<td width='$www' class='xtr'>$lang_menu12 ".$LANGAUGE_CP[483]."</td>
<td width='$hhh' class='xtd' align='center'>$s1</td>
<td width='$www1' class='xtr'>$lang_menu12 ".$LANGAUGE_CP[484]."</td>
<td width='$hhh1' class='xtd' align='center'>$s101</td>
</tr>

</table>";


$page = (int) (!isset($_GET["page"]) ? 1 : $_GET["page"]);
$page = ($page == 0 ? 1 : $page);
$perpage = 30;
$startpoint = ($page * $perpage) - $perpage;

if(isset($_GET["c"]) AND $_GET["c"]=="counter"){
$orders = "counter";
$pagesm = "&c=".$_GET['c']."";
}else{
$orders = "id";
$pagesm = "";
}
$numss = mysql_num_rows(mysql_query("select * from stats"));

$numx = mysql_query("select * from stats order by $orders desc LIMIT $startpoint,$perpage");
$refnumberx = mysql_num_rows($numx);
if($refnumberx==0){
$b = "";
}else{
$b = "<table class='xtable' width='100%' id='AuoNumbdfer15'>
<tr>
<td width='100%' colspan='4' class='xtx' align='center'>".$LANGAUGE_CP[485]."</td>
</tr>

<tr>
<td width='100%' colspan='4' class='xtr' align='center'>".$LANGAUGE_CP[486]."</td>
</tr>
<tr>
<td align='center' class='xtr' width='55%'>".$LANGAUGE_CP[487]."</td>
<td align='center' class='xtr' width='15%'>".$LANGAUGE_CP[488]."</td>
<td class='xtr' align='center' width='15%'>".$LANGAUGE_CP[489]."</td>
<td class='xtr' align='center' width='15%'>".$LANGAUGE_CP[106]."</td>
</tr>";

while($rrr = mysql_fetch_array($numx))
{
$refere = stripslashes($rrr['refere']);
$refere = htmlspecialchars($refere);

if(strlen($refere) > 60 ){
$t = substr($refere,0,60);
$ref = $t." ...";
}else{
$ref = $refere;
}

$ip = htmlspecialchars($rrr['ip']);

$d = date("j/n/Y",$rrr['date']);

if(ereg("^[0-9a-zA-Z_:/.=+%&-]+$" , $refere)){
$links = parse_url($refere);
$llinkk = $links[host];
}else{
$llinkk = $refere;
}


if($_SERVER['SERVER_NAME'] != $llinkk){
$w = $refere;
}else{
$w = $llinkk;
}

$b .= "<tr>
<td width='55%' class='xtd' align='left' dir='ltr'><a target='_blank' href='$refere'>$ref</a></td>
<td align='center' width='15%' class='xtd'>$d</td>
<td align='center' width='15%' class='xtd'>$ip</td>
<td align='center' width='15%' class='xtd'>".$rrr['counter']."</td>
</tr>";
}

$pagesnum = @ceil(mysql_num_rows(mysql_query("SELECT id FROM stats")) / $perpage);

$b .= "<tr>
<td class='xtr' colspan='4' align='center'>
<form name='guideform'>
".$LANGAUGE_CP[490]." $numss ".$LANGAUGE_CP[491]." $pagesnum ".$LANGAUGE_CP[492]." <select name='guidelinks' size='1' onchange=\"window.location=document.guideform.guidelinks.options[document.guideform.guidelinks.selectedIndex].value\">\n";

for ($i=1; $i<=$pagesnum; $i++) {
if ($i != $page) {
$z = "<option value='stats.php?page=$i".$pagesm."'>".$i."</option>\n";
} else {
$z = "<option selected value=\"javascript:void(0)\">".$i."</option>\n";
}
$b .= "$z";
}
$b .= "</select>
</form>\n
</td>
</tr>";
}

$b .= "</table>";
echo $b;

echo "<br />";

$pages = (int) (!isset($_GET["pages"]) ? 1 : $_GET["pages"]);
$pages = ($pages == 0 ? 1 : $pages);
$perpage = 30;
$startpoint = ($pages * $perpage) - $perpage;

$numxs = mysql_query("select * from search order by date desc LIMIT $startpoint,$perpage");
$refnumberxs = mysql_num_rows($numxs);
if($refnumberxs==0){
$bs = "";
}else{
$bs = "<table class='xtable' width='100%' id='Aut4soNumber15'>
<tr>
<td width='100%' colspan='3' class='xtx' align='center'>".$LANGAUGE_CP[493]."</td>
</tr>
<tr>
<td align='center' class='xtr' width='60%'>".$LANGAUGE_CP[494]."</td>
<td align='center' class='xtr' width='20%'>".$LANGAUGE_CP[495]."</td>
<td class='xtr' align='center' width='20%'>".$LANGAUGE_CP[496]."</td>
</tr>";

while($rrrs = mysql_fetch_array($numxs))
{
$referes = htmlspecialchars($rrrs['name']);
$referes = stripslashes($referes);

$dsx = date("j/n/Y",$rrrs['date']);

$bs .= "<tr>
<td width='60%' class='xtd'>$referes</td>
<td align='center' width='20%' class='xtd'>$dsx</td>
<td align='center' width='20%' class='xtd'>".$rrrs['counter']."</td>
</tr>";
}

$bs .= "</table>";

$pagesnum = @ceil(mysql_num_rows(mysql_query("SELECT id FROM search")) / $perpage);
if($pagesnum > 1){
$bs .= "<p align='center'>";
for ($i=1; $i<=$pagesnum; $i++) {
if ($i != $pages) {
$z = "[<a href='stats.php?pages=$i'>$i</a>] ";
} else {
$z = "[<u>$i</u>]";
}
$bs .= "$z";
}
$bs .= "</p>";
}
}

echo $bs;

echo $f;
?>