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


$selectuser = @mysql_db_query("$dbName", "SELECT * FROM `users`   where   user_id = '$_GET[id]'") ;
while  ($user = mysql_fetch_array($selectuser)){
$username =  $user[user_name];
$passworddb =  $user[user_password];
$mail = $user[user_mail];
$group = $user[user_group];
$v = $user[user_visit];
}

?>
<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>
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>
<?
if (($_GET['go'])==('')){
?>
  <table width="20%" align="center"  cellpadding="0" cellspacing="0" class="mytable">
    <tr>
      <td>
<form name="" action="edituser.php?id=3&go=edit" method="post">
      <div align="center">
          <table width="368" height="100%" align="center" bordercolor="#006633">
            <tr>
              <td width="362" class="backtablemun" colspan="2">
				<p align="center">تعديل خيارات عضو </td>
            </tr>
            <tr>
              <td width="96" class="submun">
				<p align="center">اسم المستخدم : </td>
              <td width="262" class="subsub" >
				<font color="#FF0000">
				<input name="username" type="text" value="<?echo $username ?>" size="33" dir="rtl"></font></td>
            </tr>
            <tr>
              <td width="96" class="submun">
				<p align="center">البريد الالكتروني :</td>
              <td width="262" class="subsub" >
				<font color="#FF0000">
				<input name="mail" type="text" value="<?echo $mail ?>" size="33" dir="ltr"></font></td>
            </tr>
            <tr>
              <td width="96"  class="submun">
				<p align="center">كلمة المـــــــرور : </td>
              <td width="262" class="subsub">
				<font color="#FF0000">
				<input name="password" type="password" value="" size="33" dir="rtl"></font></td>
            </tr>
            <tr>
              <td width="96"  class="submun">
				<p align="center">حــــــــــالة العضو :</td>
              <td width="262" class="subsub">
				<span lang="ar-sa">
				<input name="status" type="radio" id="1" value="1"
				<?
    			if (($group)=="1"){
                echo"checked";
    			}
				 ?>
				></span><label for="1"><span lang="en-us">
				</span>
				<span lang="ar-eg">
				نشط</span></label><br>
				<input name="status" type="radio" id="2" value="2"
				<?
				if (($group)=="2"){
                echo"checked";
    			}
                ?>
				><label for="2"><span lang="en-us">
				</span>بانتظار التفعيل</label><br>
				<input name="status" type="radio" id="3" value="3"
				<?
				if (($group)=="3"){
                echo"checked";
    			}
                ?>
				><label for="3"><span lang="en-us">
				</span>محظور</label></td>
            </tr>
            <tr>
              <td width="96"  class="submun">
				&nbsp;</td>
              <td width="262" class="subsub">
				<p align="center">&nbsp;<input type="submit" value="تعديل"></td>
            </tr>
            </table>
        </div>
        <input name="tr" type="hidden" value="<?echo $_GET[id]?>">
        </form>
        </td>
    </tr>
  </table>

<?
}elseif (($_GET['go'])==('edit')){
$username = trim($_POST['username']);
$mail = trim($_POST['mail']);
$testpass = trim($_POST['password']);
if (($testpass)==('')){
$password = $passworddb;
}else{
$password = md5($testpass);
}
$gr = $_POST['status'];
$id = $_POST['tr'];
$update = @mysql_db_query("$dbName", "
UPDATE `users` SET
`user_name` = '$username',
`user_password` = '$password',
`user_mail` = '$mail',
`user_group` = '$gr'
WHERE `user_id` = '$id'  ;

") ;
 if ($update){
 ?>
 <br>
  <table width="21%" align="center"  cellpadding="0" cellspacing="0" class="mytable">
    <tr>
      <td>
      <div align="center">
          <table width="304" height="100%" align="center" bordercolor="#006633">
            <tr>
              <td width="298" class="backtablemun">
				<p align="center"><span lang="ar-eg">الرسالة</span></td>
            </tr>
            <tr>
              <td width="298" class="submun">
				<p align="center"><span lang="ar-eg">تم تعديل معلومات العضو
				بنجاح</span></td>
            </tr>
            </table>
        </div>
        </td>
    </tr>

  </table>

  <br>
  <div align="center"><br><a href='javascript:window.close();'>اغلاق النافذه</a></div>
 <?
 }else{
 ?>
 <br>
  <table width="21%" align="center"  cellpadding="0" cellspacing="0" class="mytable">
    <tr>
      <td>
      <div align="center">
          <table width="304" height="100%" align="center" bordercolor="#006633">
            <tr>
              <td width="298" class="backtablemun">
				<p align="center"><span lang="ar-eg">الرسالة</span></td>
            </tr>
            <tr>
              <td width="298" class="submun">
				<p align="center"><span lang="ar-eg">عفواً هناك مشكلة بتعديل
				معلومات هذا العضو </span></td>
            </tr>
            </table>
        </div>
        </td>
    </tr>
  </table>

  <br>

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