<?
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'];
}
$loguser= $_COOKIE['adminuser'];
$logipass= $_COOKIE['adminpassword'];



if ( $adminp == $logipass  && $adminu == $loguser ){

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

<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>
  <?

if (($_GET['go'])==('')){

$selectsetting = @mysql_db_query("$dbName", "SELECT * FROM `setting`   where  site_id = '1'") ;
while  ($info = mysql_fetch_array($selectsetting)){
$sitename = $info['site_name'];
$sitelink = $info['site_link'];
$sitemeta= $info['site_meta'];
$sitemail= $info['site_mail'];
$register= $info['site_register'];
$comment=$info['site_comment'];
$search=$info['site_search'];
$html=   $info['site_html'];
$close= $info['site_close'];
$message=  $info['site_message'];
}
?>
<br>
  <table width="72%" align="center"  cellpadding="0" cellspacing="0" class="mytable">
    <tr>
      <td>
<form name="" action="setting.php?go=update" method="post">
      <div align="center">
          <table width="714" height="100%" align="center" bordercolor="#006633">
            <tr>
              <td width="708" class="backtablemun" colspan="3">
				<p align="center"><span lang="ar-sa">الاعدادت العامة</span></td>
            </tr>
            <tr>
              <td width="187" class="submun">
				<p align="center">اســــــــــــم المــــــــــــــــوقع : </td>
              <td width="517" class="subsub" colspan="2" >
				<font color="#FF0000">
				<input name="sitename" type="text" value="<?echo $sitename;?>" size="63" dir="rtl"></font></td>
            </tr>
            <tr>
              <td width="187" class="submun">
				<p align="center">رابــــــــــط المـــــــــــــــــــوقع : </td>
              <td width="517" class="subsub" colspan="2">
			<font color="#FF0000">
			<input name="sitelink" type="text" value="<?echo $sitelink;?>" size="63" dir="ltr"></font></td>
            </tr>
            <tr>
              <td width="187"  class="submun">
				<p align="center">وصــــــــــف المــــــــــــــــــوقع : </td>
              <td width="517" class="subsub" colspan="2">
				<font color="#FF0000">
				<input name="sitemeta" type="text" value="<?echo $sitemeta;?>" size="63" dir="rtl"></font></td>
            </tr>
            <tr>
              <td width="187"  class="submun">
				<p align="center">بـــــــــــريد مديـــــر الموقـــــــــع : </td>
              <td width="517" class="subsub" colspan="2">
				<font color="#FF0000">
				<input name="sitemail" type="text" value="<?echo $sitemail;?>" size="63" dir="ltr"></font></td>
            </tr>
            <tr>
              <td width="187"  class="submun">
				<p align="center">تفعــــــيل تســــــجيل الأعضــــــاء:</td>
              <td width="164" class="subsub">
				<p align="center"><font color="#FF0000">
				<span lang="en-us">&nbsp; </span>
				<input name="register" type="radio" id="registeryes" value="yes"
				<?
				if (($register)==('yes')){
				echo "checked";}
				?>
				 ><label for="registeryes">&nbsp; نعم</label></font></td>
              <td width="349" class="subsub">
				<font color="#FF0000">
				<input name="register" type="radio" id="registerno"  value="no"
				<?
				if (($register)==('no')){
				echo "checked";}
				?>

				><label for="registerno">&nbsp; لا</label></font></td>
            </tr>
            <tr>
              <td width="187"  class="submun">
				<p align="center">تفعــــــــــيل التعليقـــــــــــــــــات : </td>
              <td width="164" class="subsub">
				<p align="center"><font color="#FF0000">
				<input name="comment" type="radio" id="registeryes0" value="yes"
								<?
				if (($comment)==('yes')){
				echo "checked";}
				?>

				><label for="registeryes0"> 	نعم </label></font></td>
              <td width="349" class="subsub">
				<font color="#FF0000">
				<input name="comment" type="radio" id="registeryes1" value="no"
				<?
				if (($comment)==('no')){
				echo "checked";}
				?>
				>
			<label for="registeryes1">	لا </label></font></td>
            </tr>

            <tr>
              <td width="187"  class="submun">
				<p align="center">تفعيل محرك البحث بالموقع : </td>
              <td width="164" class="subsub">
				<p align="center"><font color="#FF0000">
				<input name="html" type="radio" id="registeryes4" value="yes"
				<?
				if (($html)==('yes')){
				echo "checked";}
				?>
				>
			<label for="registeryes4">	نعم </label></font></td>
              <td width="349" class="subsub">
				<font color="#FF0000">
				<input name="html" type="radio" id="registeryes5" value="no"
				<?
				if (($html)==('no')){
				echo "checked";}
				?>
				>
			<label for="registeryes5">	لا</label></font></td>
            </tr>
            <tr>
              <td width="187"  class="submun">
				<p align="center">إغــــــــــلاق المــــــــــــــــــــــوقع : </td>
              <td width="164" class="subsub">
				<p align="center"><font color="#FF0000">
				<input name="close" type="radio" id="registeryes6" value="yes"
				<?
				if (($close)==('yes')){
				echo "checked";}
				?>
				>
			<label for="registeryes6">	نعم </label></font></td>
              <td width="349" class="subsub">
				<font color="#FF0000">
				<input name="close" type="radio" id="registeryes7" value="no"
				<?
				if (($close)==('no')){
				echo "checked";}
				?>
				>
			<label for="registeryes7">	لا</label></font></td>
            </tr>
            <tr>
              <td width="187"  class="submun">
				<p align="center">رســــــــــــالة الإغـــــــــــــــــــلاق : </td>
              <td width="517" class="subsub" colspan="2">
				<font color="#FF0000">&nbsp;<textarea rows="4" cols="60" class="traid" name="message"><?echo $message;?></textarea></font></td>
            </tr>
            <tr>
              <td width="187"  class="submun">
				&nbsp;</td>
              <td width="517" class="subsub" colspan="2">
				<p align="center">&nbsp;<input type="submit" value="تعديل "></td>
            </tr>
            </table>
        </div>
        </form>
        </td>
    </tr>
  </table>

<?
}elseif (($_GET['go'])==('update')){
$sitename = trim ($_POST['sitename']);
$sitelink = trim ($_POST['sitelink']);
$sitemeta=  trim ($_POST['sitemeta']);
$sitemail=  trim ($_POST['sitemail']);
$register=  trim ($_POST['register']);
$comment=   trim ($_POST['comment']);
$search=    trim ($_POST['search']);
$html=      trim ($_POST['html']);
$close=    trim ($_POST['close']);
$message=  trim ($_POST['message']);


$updatesetting = @mysql_db_query("$dbName", "
UPDATE `setting` SET
`site_name` = '$sitename',
`site_link` = '$sitelink',
`site_meta` = '$sitemeta',
`site_mail` = '$sitemail',
`site_register` = '$register',
`site_comment` = '$comment',
`site_search` = '$search',
`site_html` = '$html',
`site_close` = '$close',
`site_message` = '$message'
WHERE `site_id` =1 LIMIT 1 ;
") ;



if ($updatesetting){
?>
<META HTTP-EQUIV='Refresh' CONTENT='2; url=setting.php'>
<br>
<br>
<br>
  <table width="72%" align="center"  cellpadding="0" cellspacing="0" class="mytable">
    <tr>
      <td>
      <div align="center">
          <table width="714" height="100%" align="center" bordercolor="#006633">
            <tr>
              <td width="708" class="backtablemun">
				<p align="center">الرسالة</td>
            </tr>
            <tr>
              <td width="704" class="submun">
				<p align="center">تم تعديل البيانات بنجاح </td>
            </tr>
            </table>
        </div>
        </td>
    </tr>
  </table>
<?
}else{
?>
<br>
<br>
<br>
<META HTTP-EQUIV='Refresh' CONTENT='2; url=setting.php'>
  <table width="72%" align="center"  cellpadding="0" cellspacing="0" class="mytable">
    <tr>
      <td>
      <div align="center">
          <table width="714" height="100%" align="center" bordercolor="#006633">
            <tr>
              <td width="708" class="backtablemun">
				<p align="center">الرسالة</td>
            </tr>
            <tr>
              <td width="704" class="submun">
				<p align="center">عفواً هناك مشكلة بتعديل البيانات</td>
            </tr>
            </table>
        </div>
        </td>
    </tr>
  </table>

<?
}
}
?>

        <br>
      </td>
    </tr>

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

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