<?php session_start();
include("dbf.php");
?>
<script type="text/javascript" src="script.js" ></script>
<style type="text/css">
td
 {
    font-size: 10pt;
    font-family: Tahoma, Arial, Helvetica, sans-serif;
    padding-top:5px;
    padding-bottom:5px;
 }
</style>
<?php
if($_SESSION[user]!='')
{
  $mode=$_GET["mode"];
  if($_GET['new'])
   {
    $titl='ثبت كاربر';
    $disabled='';
    $readonly='';
   }
   elseif($mode=="update")
   {
    $titl='ويرايش كاربر';
    $disabled='';
    $readonly='readonly';
   }
  else
  {
    $titl='حذف كاربر';
    $disabled='disabled';
    $readonly='readonly';
  }

   $qf=mysql_query("select * from login where (id='{$_GET[q2]}') ");
   $rf=mysql_fetch_array($qf);
  ?>
<form method="post" action="user2.php">
 <table dir="rtl" border="1" width="55%" bgcolor="#87CEEB" cellspacing="0.25">
  <input type="hidden" id="id" name="id" value="<?php echo $_GET[q2]; ?>">
   <tr>
     <td colspan="2"><?php echo $titl; ?></td>
   </tr>
   <tr>
     <td>نام كاربري</td>
     <td>
	  <input type="text" <?php echo $readonly; ?>  id="user1" name="user1" value="<?php echo $rf[user]; ?>">
	 </td>
   </tr>
   <tr>
     <td>نام و نام خانوادگي</td>
     <td><input type="text" <?php echo $readonly; ?> id="name" name="name" value="<?php echo $rf[name]; ?>"></td>
   </tr>
    <?php
	if($mode!="delete")
	{
	?>
   <tr>
     <td>رمز عبور</td>
     <td><input type="password" id="pass" name="pass"  ></td>
   </tr>
   <tr>
     <td>تكرار رمز عبور</td>
     <td><input type="password" id="rpass" <?php echo $disabled; ?>  onblur="equal()"></td>
   </tr>
   <?php
	}
	?>
   <tr>
     <td colspan="2" align="center">
       <table dir="rtl" border="1" width="100%" cellspacing="0.25" >
         <tr bgcolor="#006699" align="center">
           <td>اعضا</td>
           <td>كتاب</td>
           <td>متن</td>
           <td>امانات</td>
           <td>مجلات</td>
           <td>ساير موارد</td>
		 </tr>
		 <tr>
		 <td valign="top">
		   <table dir="ltr" border="0" width="100%" align="right" >
		     <tr align="right">
			  <td>اعضا<input id="ozve"   name="ozve" type="checkbox"  value="1"  <?php if($rf['ozve']==1) {?> checked <?php } echo $disabled; ?>   ></td>
			 </tr>
			 <tr align="right">
			  <td>اعضایی که تاریخ عضویت آن ها منقضی شده<input id="ozve1"   name="ozve1" type="checkbox"  value="1" <?php if($rf['ozve1']==1) {?> checked <?php } echo $disabled; ?>  ></td>
			 </tr>
			 <tr align="right">
			  <td>تعيين تاريخ انقضا<input id="ozve2"   name="ozve2" type="checkbox"  value="1"  <?php if($rf['ozve2']==1) {?> checked <?php } echo $disabled; ?> ></td>
			 </tr>
			 <tr align="right">
			  <td>پرينت كارت<input id="ozve3"   name="ozve3" type="checkbox"  value="1"  <?php if($rf['ozve3']==1) {?> checked <?php } echo $disabled; ?> ></td>
			 </tr>
		   </table>
		  </td>
		  <td valign="top">
		   <table dir="ltr" border="0" width="100%" align="right"  >
		     <tr align="right">
			  <td>كتاب<input id="book"   name="book" type="checkbox"  value="1" <?php if($rf['book']==1) {?> checked <?php } echo $disabled; ?>></td>
			 </tr>
			 <tr align="right">
			  <td>موضوع<input id="book1"   name="book1" type="checkbox"  value="1" <?php if($rf['book1']==1) {?> checked <?php } echo $disabled; ?>></td>
			 </tr>
			  <tr align="right">
			  <td>درخواست كتاب<input id="book2"   name="book2" type="checkbox"  value="1" <?php if($rf['book2']==1) {?> checked <?php } echo $disabled; ?>></td>
			 </tr>
		   </table>
		  </td>
		  <td valign="top">
		   <table dir="ltr" border="0" width="100%" align="right">
		     <tr align="right">
			  <td>متن<input id="txt"   name="txt" type="checkbox"  value="1"   <?php if($rf['txt']==1) {?> checked <?php } echo $disabled; ?>></td>
			 </tr>
			 <tr align="right">
			  <td>آپلود کتاب<input id="txt1"   name="txt1" type="checkbox"  value="1"  <?php if($rf['txt1']==1) {?> checked <?php } echo $disabled; ?> ></td>
			 </tr>
		   </table>
		  </td>
		  <td valign="top">
		   <table dir="ltr" border="0" width="100%" align="right">
		     <tr align="right">
			  <td>امانات<input id="req"     name="req"    type="checkbox"    value="1" <?php if($rf['req']==1) {?> checked <?php } echo $disabled; ?> ></td>
			 </tr>
			 <tr align="right">
			  <td>متاخرین در امانت<input id="req1"    name="req1"   type="checkbox"    value="1" <?php if($rf['req1']==1) {?> checked <?php } echo $disabled; ?> ></td>
			 </tr>
			 <tr align="right">
			  <td>کارمزد<input id="req2"    name="req2"   type="checkbox"    value="1" <?php if($rf['req2']==1) {?> checked <?php } echo $disabled; ?> ></td>
			 </tr>
			 <tr align="right">
			  <td>امانت موقت<input id="req3"    name="req3"   type="checkbox"    value="1" <?php if($rf['req3']==1) {?> checked <?php } echo $disabled; ?> ></td>
			 </tr>
			 <tr align="right">
			  <td>مدت امانت و هزینه ی دیرکرد<input id="req4"    name="req4"   type="checkbox"    value="1" <?php if($rf['req4']==1) {?> checked <?php } echo $disabled;?> ></td>
			 </tr>
			 <tr align="right">
			  <td>امانت كتاب<input id="req5"    name="req5"   type="checkbox"    value="1" <?php if($rf['req5']==1) {?> checked <?php } echo $disabled;?>></td>
			 </tr>
			 <tr align="right">
			  <td>ليست امانات<input id="req6"    name="req6"   type="checkbox"    value="1" <?php if($rf['req6']==1) {?> checked <?php } echo $disabled;?> ></td>
			 </tr>
			 <tr align="right">
			  <td>ليست اشخاص<input id="req7"    name="req7"   type="checkbox"    value="1"  <?php if($rf['req7']==1) {?> checked <?php } echo $disabled;?> ></td>
			 </tr>
			 <tr align="right">
			  <td>وضعيت امانت كتاب<input id="req8"    name="req8"   type="checkbox"    value="1" <?php if($rf['req8']==1) {?> checked <?php } echo $disabled; ?> ></td>
			 </tr>
			 <tr align="right">
			  <td>بازگشت كتاب<input id="req9"    name="req9"   type="checkbox"    value="1" <?php if($rf['req9']==1) {?> checked <?php }echo $disabled; ?> ></td>
			 </tr>
			 <tr align="right">
			  <td>رزرو كتاب<input id="req10"    name="req10"   type="checkbox"    value="1" <?php if($rf['req10']==1) {?> checked <?php } echo $disabled; ?> ></td>
			 </tr>
		   </table>
		  </td>
		   <td valign="top">
		   <table dir="ltr" border="0" width="100%" align="right">
		     <tr align="right">
			  <td>مجلات<input id="majale"   name="majale" type="checkbox"  value="1"  <?php if($rf['majale']==1) {?> checked <?php }echo $disabled;  ?> ></td>
			 </tr>
			 <tr align="right">
			  <td>مقالات<input id="majale1"   name="majale1" type="checkbox"  value="1" <?php if($rf['majale1']==1) {?> checked <?php } echo $disabled; ?>  ></td>
			 </tr>
		   </table>
		  </td>
		   <td valign="top">
		   <table dir="ltr" border="0" width="100%" align="right">
		     <tr align="right">
			  <td>كد كنگره<input id="dio"   name="dio" type="checkbox"  value="1" <?php if($rf['dio']==1) {?> checked <?php } echo $disabled; ?>  ></td>
			 </tr>
			 <tr align="right">
			  <td>cd بانك <input id="cd"   name="cd" type="checkbox"  value="1"  <?php if($rf['cd']==1) {?> checked <?php } echo $disabled;  ?> ></td>
			 </tr>
			 <tr align="right">
			  <td>رمزكاربري<input id="usr"   name="usr" type="checkbox"  value="1" <?php if($rf['usr']==1) {?> checked <?php } echo $disabled; ?>  ></td>
			 </tr>
			 <tr align="right">
			  <td>راهنماي كاربري<input id="help"   name="help" type="checkbox"  value="1"  <?php if($rf['help']==1) {?> checked <?php } echo $disabled; ?> ></td>
			 </tr>
		   </table>
		  </td>
		 </tr>
		 <tr>
		 	<td align="left" colspan="7">
			 	مدیر<input id="modir"   name="modir" type="checkbox"  value="1"  <?php if($rf['modir']==1) {?> checked <?php } echo $disabled; ?> >
			</td>
		 </tr>
		 <tr>
		  <td colspan="6" align="center">
		  <?php
		   if($_GET['new'])
           {
           ?>
            <button type="submit"  name="sabt" onclick="return emptyValidation('user1~name~pass~rpass')"><img src="images/sabtf2.png"  border="0" width="20" height="20" ></button>
           <?php
           }
		   elseif($mode=="update")
		   {
		   ?>
		    <button type="submit"  name="edit" onclick="return emptyValidation('name')"><img src="images/b_edit.png"  border="0" width="20" height="20" ></button>
		  <?php
		   }
		   else
		   {
		   ?>
		   <button type="submit"  name="del"><img src="images/b_drop.png"  border="0" width="20" height="20" ></button>
		   <?php
		   }
		   ?>
		  <button type="button"  onClick="ajaxload('user.php')"><img src="images/r1.png"  border="0" width="20" height="20" ></button>
		  </td>
		 </tr>
	   </table>
	 </td>
   </tr>
 </table>
 </form>
<?php
}
else
 echo"<script>window.location='index.php'</script>";


?>

