<?php
session_start();
if($_SESSION[id]!=""){
?>
<html dir="rtl">
<style>
td
{
  padding-top:10px
}

</style>
<?php
include ('dbf.php');
$mode=$_GET["mode"];
$q=$_GET['id'];
if($mode=="update")
{
	//include ('header.php');
	$q=$_GET[q2];
	include ('dbf.php');
	$fg=mysql_query("select * from `matn` where (matn.ip='$q')");
	$v=mysql_fetch_assoc($fg);
	$fg=mysql_query("select * from ketab where (id='{$v['id']}')");
	$h=mysql_fetch_assoc($fg);
	$pic=$h['pic'];
	?>

	<table width="550" border="0" align="center" dir="rtl">
	<tr>
	<td >
		<?php if($pic!=''){?><img  width="150" height="150"  src="books/<?php echo $pic;?>"><?php }?>
	</td>
	<td>
	<div class="divfieldset">
	<fieldset style="width:550px"><legend align="right" >ويرايش مشخصات متن </legend>
	<table align="center" border="0" dir="rtl" class="table"  >
		<tr>
			<td  class="label">

				<input type="hidden" size="20"  name="id" value="<?php echo $h['id'];?>">
				<span>	نــــــــام كتاب  :</span>

			</td>
			<td><span class="blacktext"><?php echo $h['name'];?></span></td>
		</tr>
		<tr>
			<?php
			include ('dbf.php');
			$fg=mysql_query("select * from `matn` where (matn.ip='$q')");
			$v=mysql_fetch_assoc($fg);
			?>
			<td  class="label">
				<span> شما ره صفحه :</span>
				<input type="hidden" size="20" name="paje" id="paje" value="<?php echo $v['paje'];?>">

			</td>
			<td><span class="blacktext"> <?php echo $v['paje'];?></span></td>
		</tr>
    <input type="hidden"  id="val" name="val" value="" >
		<tr>
			<td class="label" valign="top">
				<span>*متن :</span>
			</td>
			<td align="center">
				<TEXTAREA style="font-family:tahoma;font-size:10pt"
				 ID=name name="name" cols="60" rows="10" dir="rtl"><?php echo $v['name'];?></textarea>
			</td>
		</tr>
		<tr>
			<td colspan="2" align="center">
				<table>
					<tr>
						<td>
							<button tabindex="13" title="اصلاح" type="button" onClick="param('name,paje'),update(document.getElementById('val').value,'a_textpage.php','<?php echo $q;?>','name,paje')"><img src="images/b_edit.png"  name="eslah"  border="0" width="20" height="20" ></button>
						</td>
						<td>
							<button tabindex="14" title="بازگشت" type="button"  onClick="ajaxload('textpage.php')"><img src="images/r1.png"  name="eslah"  border="0" width="20" height="20" ></button>
						</td>
					</tr>
				</table>
			</td>
		</tr>
	</table>
	</td>
	</tr>
	</table>
	</fieldset>
</div>
	<?php

}
elseif($mode=="see")
{
    $q=$_GET[q2];
	$fg=mysql_query("select * from `matn` where (matn.ip='$q')");
	$v=mysql_fetch_assoc($fg);
	$fg=mysql_query("select * from ketab where (id='{$v['id']}')");
	$h=mysql_fetch_assoc($fg);
	$pic=$h['pic'];
	?>

	<table width="550" border="0" align="center" dir="rtl">
	<tr>
	<td>
		<?php if($pic!=''){?><img  width="150" height="150"  src="books/<?php echo $pic;?>"><?php }?>
	</td>
	<td valign="top">
	<div class="divfieldset">
	<fieldset style="width:550px"><legend align="right" >	مشاهده مشخصات متن </legend>
	<table align="center" border="0" dir="rtl" class="table">
	<form name="uy" method="post" action="index1.php?page=three">
		<tr>
			<td colspan="2" align="right" class="label">
				<input type="hidden" size="20" name="id" value="<?php echo $h['id'];?>">
				<span>	نــــــــام كتاب          :
				<?php echo $h['name'];?></span>
			</td>
		</tr>
		<tr>
			<?php
			include ('dbf.php');
			$fg=mysql_query("select * from `matn` where (matn.ip='$q')");
			$v=mysql_fetch_assoc($fg);
			?>
			<td align="right" colspan="2" class="label">
				<span>	شما ره صفحه:
				<input type="hidden" size="20" name="paje" value="<?php echo $v['paje'];?>">
				<?php echo $v['paje'];?></span>
			</td>
		</tr>
		<tr>
			<td class="label" valign="top">
				<span >متــــــن :</span>
			</td>
			<td align="center">
				<TEXTAREA style="font-family:tahoma;font-size:10pt" readonly
				 ID=txtComments name="name" cols="60" rows="10" dir="rtl"><?php echo $v['name'];?></textarea>
			</td>
		</tr>
		<tr>
			<td colspan="2" align="center">
				<button tabindex="1" title="بازگشت" name="cancel" type="button" onClick="ajaxload('textpage.php')"><img src="images/r1.png"  name="eslah"  border="0" width="20" height="20" ></button>
			</td>
		</tr>
		</tr>
	</form>
	</table>
	</fieldset>
</div>
	</td>

	</tr>
	</table>

	<?php

		}
elseif($mode=="delete")
{
	$q=$_GET[q2];
	$fg=mysql_query("select * from `matn` where (matn.ip='$q')");
	$v=mysql_fetch_assoc($fg);
	$fg=mysql_query("select * from ketab where (id='{$v['id']}')");
	$h=mysql_fetch_assoc($fg);
	$pic=$h['pic'];
	?>
	<table width="550" border="0" align="center" dir="rtl" class="table">
	<tr>
	<td>
		<?php if($pic!=''){?><img  width="150" height="150"  src="books/<?php echo $pic;?>"><?php }?>
	</td>

	<td>
	<div class="divfieldset">
	<fieldset style="width:550px"><legend align="right" >حذف مشخصات متن </legend>
	<table align="center" border="0" dir="rtl" class="table" style="width:550px">
		<tr>
		<?php
		$fg=mysql_query("select * from `matn` where (matn.ip='$q')");
		$v=mysql_fetch_assoc($fg);
		?>
			<td  class="label">
				<span>
				<input type="hidden" name="ip" value="<?php echo $v['ip']; ?>">
				<input type="hidden" name="id" value="<?php echo $v['id']; ?>">
				شماره ثبت كتاب          :
				</span>
			</td>
			<td  >
				<span class="blacktext">
				<?php
				echo $v['id'];
				?>
				</span>
			</td>
		</tr>
		<tr>
			<td class="label">
				<input type="hidden" name="paje" value="<?php echo $v['paje']; ?>">
				<span>
				شماره صفحه        :</span>
			</td>
			<td >
				<span class="blacktext">
				<?php
				echo $v['paje'];
				?>
				</span>
			</td>
		</tr>
		<tr>
			<td class="label" valign="top">
				<span >
				<input type="hidden" name="lname" value="	<?php echo $v['name'];?>">
				مـــــتن:
				</span>
			</td>
			<td >
				<span class="blacktext">
				<TEXTAREA style="font-family:tahoma;font-size:10pt" readonly
				 ID=txtComments name="name" cols="60" rows="10" dir="rtl"><?php echo $v['name'];?></textarea>

				</span>
			</td>
		</tr>
		<tr>
			<td colspan="2" align="center">
				<table>
					<tr>
						<td>
							<button tabindex="1" title="حذف" type="button" onClick="dele('a_textpage.php','<?php echo $q;?>',ajaxload('textpage.php'))"><img src="images/b_drop.png"  name="del"  border="0" width="20" height="20" ></button>
						</td>

						<td>
							<button tabindex="2" title="بازگشت" type="button" onClick="ajaxload('textpage.php')"><img src="images/r1.png"  name="eslah"  border="0" width="20" height="20" ></button>
						</td>
					</tr>
				</table>
			</td>
		</tr>
		</tr>

	</table>
	</td>
	<td valign="top" align="center" width="150">
		<?php
		//include ('menu.html');
		?>
	</td>
	</tr>
	</table>
	<?php
		//include ('foteer.php');
}
elseif ($_GET['new'])
{
?>
	<table  width="550" border="0" align="center" dir="rtl">
			<tr>
				<td align="center">
				  <div class="divfieldset">
	                  <fieldset style="width:550px"><legend align="right" >ثبت مشخصات متن </legend>
							<table  border="0" dir="rtl"  class="table" >

								<tr>
									<td  class="label"  >
										<span> 	نــــــــام كتاب         :</span>
										</td><td>
										<select name="id" id="id" >
											<option value="" >انتخاب كتاب</option>
												<?php
												include ('dbf.php');
												$fg=mysql_query("select * from ketab where (city='{$_SESSION[city]}') order by `name`");
												while($v=mysql_fetch_assoc($fg)){
												?>
												<option value="<?php echo $v['id'];?>" style="font-size: 9pt;font-family:tahoma"><?php echo $v['name']."<span class=bluetext>".$v['id'];?></span></option>
												<?php
												}
												?>
										</select>
									</td>
								</tr>
								<tr>
									<td   class="label" style="padding-left:10px">
										<span>  	شما ره صفحه         :</span>
										</td>
									 <td>
									    <input type="text" size="20" name="paje" id="paje"  style="cursor:hand;font-size: 10pt;font-family:tahoma">
									</td>
								</tr>
								<tr>

									<td class="label"   valign="top"><span>	متن :</span>
									</td>
									<td align="center">
										<TEXTAREA style="font-family:tahoma;font-size:10pt"
										 name="name" id="name" cols="60" rows="10" dir="rtl"></textarea>
									</td>
								</tr>
								<input type="hidden"  id="val" name="val" value="" >
                                <div id="d1"></div>
                                  <input type="hidden"  id="dval" name="dval" value="" >
								<tr>
									<td align="center" colspan="2">
										<table>
											<tr>
												<td>
													<button tabindex="14" name="ffg" type="button" onClick="param('id,name,paje'),insert(document.getElementById('val').value,'<?php echo 'a_textpage.php' ; ?>','id,name,paje')" ><img src="images/sabtf2.png"  name="neew"  border="0" width="20" height="20" ></button>
												</td>

												<td>
	          										<button tabindex="15" title="بازگشت" type="button"  onClick="ajaxload('textpage.php')"><img src="images/r1.png"  name="eslah"  border="0" width="20" height="20" ></button>
	          									</td>
											</tr>
										</table>
									</td>
								</tr>
						</table>
						 </fieldset>
                       </div>
					</form>
				</td>

		</tr>
</table>
<?php
//include ('foteer.php');
}
}
else
include('index.php');
?>
</body>
</html>