<?
include("../includes/config.php");
$adminuser = @mysql_db_query("$dbName", "select *  from admin where  admin_id = '1'") ;
while  ($ab = mysql_fetch_array($adminuser)){
$adminu = $ab['admin_name'];
$adminp = $ab['admin_password'];
$adminnote =  $ab['admin_note'];
}
$loguser= $_COOKIE['adminuser'];
$logipass= $_COOKIE['adminpassword'];



if ( $adminp == $logipass  && $adminu == $loguser ){
  if(isset($_GET[tr])){   include_once("./getupdate.php");  	}
?>
<html dir="rtl">

<head>
<meta http-equiv="Content-Type" content="text/html; charset=windows-1256">
<meta http-equiv="Content-Language" content="ar-sa">
<meta name="GENERATOR" content="Traidnt.com">
<link rel="stylesheet" href="stylesheet.css" type="text/css">
<script src="js/teleport_debug.js" type="text/javascript"></script>
 <script type="text/javascript">

		function getHttpRes(msg, state, extra){
			if(state != __RPC_SUCCESS__) return alert("هناك مشكلة بالاتصال بقاعدة البيانات");

			if (!self.orig_div1) self.orig_div1 = document.getElementById('div1').innerHTML; // Save to original content for reset
			document.getElementById('div1').innerHTML = msg + '<div align="center"><input type="button" onclick="reset_div1();" value="عودة للخلف"/></div>';
		}

		function reset_div1() {
			if (self.orig_div1) document.getElementById('div1').innerHTML = self.orig_div1;
		}

    </script>
    <script>
function TraidntPopUp(URLStr, left, top, width, height)
{
  window.open(URLStr, 'popUpWin', 'toolbar=no,location=no,directories=no,status=no,menub ar=no,scrollbar=no,resizable=no,copyhistory=yes,width='+width+',height='+height+',left='+left+', top='+top+',screenX='+left+',screenY='+top+'');
//	document.location=URLStr;
}
</script>
<title>لوحة تحكم الادارة</title>

</head>
<body leftmargin="0" rightmargin="0" bottommargin="0" topmargin="0" marginwidth="0" marginheight="0" bgcolor="#FCFAF7" text="#000000" >

<div align="left">
  <table border="0" cellpadding="0" cellspacing="0" width="100%" height="41">
    <tr>
      <td width="150%" bgcolor="#000000" height="1"></td>
    </tr>
    <tr >
      <td width="100%" align="left" valign="bottom" bgcolor="#FFFFFF" class="topheader"  >
        <p align="right"><a href="index.php">واجهة الادارة - </a>
		<a target="_blank" href="../index.php"><font color="#000000">&nbsp;واجهة
		الموقع</font></a></td>
    </tr>
  </table>
</div>

<div align="left">
  <table border="0" cellpadding="0" cellspacing="0" width="100%">
    <tr>
      <td width="20%" valign="top">
        <? include("links.php"); ?>
      </td>
      <td width="80%" valign="top" align="center">
      <br>
      <table width="90%" align="center"  cellpadding="0" cellspacing="0" class="mytable">
    <tr>
      <td>

      <div align="center">
          <table width="100%" height="100%" align="center" bordercolor="#006633">
            <tr>
              <td width="100%" class="backtablemun">
				<p align="center">الترخيص</td>
            </tr>
            <tr>
              <td class="submun"><div align="center">سكربت
				<font color="#FF0000">(<span lang="en-us">Traidnt Poem V 1.0</span> )</font>
				الإصدار الأول</div>
				<div align="center">هذه النسخة مرخصة لموقع
					: <?php echo $_SERVER[SERVER_NAME]; ?></div>
					<div align="center"><b><span lang="ar-sa">
						<font color="#006633"><a href="javascript:TraidntPopUp('getupdate.php?tr=1','125','200','400','100');">البحث
						عن إصدار جديد</a>&nbsp;&nbsp;&nbsp; </font>-<font color="#006633">&nbsp;
						<a href="javascript:TraidntPopUp('getupdate.php?tr=2','125','200','400','100');">
						البحث عن ترقية للنسخة الحالية</a></font></span></b></div></td>
            </tr>
            <tr>
              <td class="submun">
				<p align="center">جميع حقوق البرمجة محفوظة
				لــ <a href="http://traidnt.com">TRAIDNT</a><br>منزوعة من قبل مجد المنتصر - ttmtt - majd2006s</td>
            </tr>
            </table>
        </div></td>
    </tr>
  </table>
  <br>



        <table width="90%" align="center"  cellpadding="0" cellspacing="0" class="mytable">
    <tr>
      <td>
      <div id="div1">
	<form name="" action="addnote.php" method="post" target="_blank" onsubmit="new POST().submitForm(this, getHttpRes); return false;">
      <div align="center">
          <table width="100%" height="100%" align="center" bordercolor="#006633">
            <tr>
              <td width="100%" class="backtablemun">
				<p align="center">ملاحظات المدير</td>
            </tr>
            <tr>
              <td class="submun"><div align="center">
				<textarea rows="8" cols="76" class="subsub" name="adminnote"><?$notes =  iconv('utf-8','windows-1256',$adminnote);echo $notes;?></textarea></div></td>
            </tr>
            <tr>
              <td class="submun">
				<p align="center"><input type="submit" value="تعــديل">&nbsp;&nbsp;&nbsp;
				<input type="reset" value="استعادة"></td>
            </tr>
            </table>
        </div>
        </div></td>
    </tr>
  </table>
  </form>

        &nbsp;<table width="90%" align="center"  cellpadding="0" cellspacing="0" class="mytable">
    <tr>
      <td>
      <?
      //get total cat
      $selectcount= mysql_db_query("$dbName", "SELECT * FROM  cat;") ;
	  $totalcat = mysql_affected_rows();

	  //get total poem
   	$selectcount= mysql_db_query("$dbName", "SELECT * FROM  divan;") ;
	$totaldivan = mysql_affected_rows();

	//get total users
 	$selectcount= mysql_db_query("$dbName", "SELECT * FROM  users;") ;
	$totalusers = mysql_affected_rows();


	//get total comment
 	$selectcount= mysql_db_query("$dbName", "SELECT * FROM  comments;") ;
	$totalcommnets = mysql_affected_rows();

    //get total news
    $selectcount= mysql_db_query("$dbName", "SELECT * FROM  news;") ;
	$totalnews = mysql_affected_rows();

 	//get total poem waiting approve
 	$selectcount= mysql_db_query("$dbName", "SELECT * FROM  `divan` WHERE `divan`.`divan_group` ='2' ;") ;
	$totalpoemwaiting = mysql_affected_rows();

 	//get total users wating approve
 	$selectcount= mysql_db_query("$dbName", "SELECT * FROM  `users` WHERE `users`.`user_group` ='2' ;") ;
	$totaluserswaiting = mysql_affected_rows();

	//get total comments wating approve
	$selectcount= mysql_db_query("$dbName", "SELECT * FROM  `comments` WHERE `comments`.`comment_group` ='2' ;") ;
	$totalcommnetwaiting = mysql_affected_rows();
      ?>
      <div align="center">
          <table width="722" height="100%" align="center" bordercolor="#006633">
            <tr>
              <td width="716" class="backtablemun" colspan="4">
				<p align="center"><b>إحصائيات الموقع</b></td>
            </tr>
            <tr>
              <td width="188" class="submun">
				<p align="center">عـــــــــــــدد الأقســـــــــام :</td>
              <td width="155" class="subsub" align="center" ><?echo $totalcat;?></td>
              <td width="169" class="submun" align="center" >عدد الأعضاء بانتظار
				التفعيل : </td>
              <td width="192" class="subsub" align="center" ><?echo $totaluserswaiting;?></td>
            </tr>
            <tr>
              <td width="188" class="submun">
				<p align="center">عـــــــــــــدد القصــــــــــائد : </td>
              <td width="155" class="subsub" align="center">
				<?echo $totaldivan;?></td>
              <td width="169" class="submun" align="center">
				عـــــــدد التعليقـــــــــــــــات :</td>
              <td width="192" class="subsub" align="center">
				<?echo $totalcommnets;?></td>
            </tr>
            <tr>
              <td width="188"  class="submun">
				<p align="center">عدد القصائد بانتظار التفعـيل :</td>
              <td width="155" class="subsub" align="center">
				<?echo $totalpoemwaiting;?></td>
              <td width="169" class="submun" align="center">
				عدد التعليقات بانتظار التفعيل : </td>
              <td width="192" class="subsub" align="center">
				<?echo $totalcommnetwaiting;?></td>
            </tr>
            <tr>
              <td width="188"  class="submun">
				<p align="center">عـــــــدد الأعضــــــــــــــــــاء : </td>
              <td width="155" class="subsub" align="center">
				<?echo $totalusers;?></td>
              <td width="169" class="submun" align="center">
				عـــــــــــــدد الأخبـــــــــــــــار :</td>
              <td width="192" class="subsub" align="center">
				<?echo $totalnews;?></td>
            </tr>
            </table>
        </div></td>
    </tr>
  </table>





        <br>
      </td>
    </tr>

  </table>
</div>
</body>

</html>
<?
}else {
include("login.php");
	}
?>