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

</style>
<head>
<title>
صفحه کتاب ها
</title>
<body>
<?php
include ('dbf.php');
$mode=$_GET["mode"];
if($mode=="update")
{
	$q=$_GET[q2];
	$fg=mysql_query("select * from `ketab` where (ketab.ip='$q')");
	$v=mysql_fetch_assoc($fg);
	$pic=$v['pic'];
	//echo $pic;
	?>
	<form name="uy" method="post" action="a_bookpage.php" enctype="multipart/form-data">
	<table dir="rtl" width="750" border="0" align="center">
	<tr>
	<td >
		<?php if($pic!=''){?><img  width="150" height="150"  src="books/<?php echo $pic;?>"><?php }?>
	</td>
	<td align="center">
	 <div class="divfieldset">
	<fieldset style="width:400px"><legend align="right" >ويرايش مشخصات كتاب </legend>
	<table align="center" border="0" dir="rtl" class="table">

	<input type="hidden" name="city" value="<?php echo $_SESSION[city];?>">
	<input type="hidden" name="ip" value="<?php echo $v['ip'];?>">

		<tr>
			<td width="200" class="label"  >
				<span>
				<input type="hidden" name="id" id="id" value="<?php echo $v['id']; ?>">
				شماره ثبت كتاب         :
				</span>
			</td>
			<td width="200" >
				<span class="blacktext">
				<?php
				echo $v['id'];
				?>
				</span>
			</td>
		</tr>
		<tr>
			<td class="label">
				<span> * نــــــــام كتاب        :</span>
			</td>
			<td >
				<input tabindex="1" type="text" name="name" id="name" value="<?php echo $v['name']; ?>" style="font-size: 10pt;font-family:tahoma">
			</td>
		</tr>
		<tr>
			<td class="label">
				<span>* نـــــام نويسنده:</span>
			</td>
			<td >
				<input tabindex="2" type="text" name="writer" id="writer" value="<?php echo $v['writer']; ?>" style="font-size: 10pt;font-family:tahoma">
			</td>
		</tr>
		<tr>
			<td class="label">
				<span>نـــــام مترجـم :</span>
			</td>
			<td >
				<input tabindex="3" type="text" name="motarjem" value="<?php echo $v['motarjem']; ?>" style="font-size: 10pt;font-family:tahoma">
			</td>
		</tr>
		<tr>
			<td class="label">
				<span>* موضـــــــــوع :</span>
			</td>
			<td >
				<select tabindex="5" name="topic" id="topic" style="font-size: 9pt;font-family:tahoma">
				<?php
				$f1=mysql_query("select * from mozo ");
				while($ff1=mysql_fetch_assoc($f1)){
				?>
					<option <?php if($ff1['moz']==$v['topic']){ ?> selected <?php }?>  value="<?php echo $ff1['moz']; ?>" style="font-size: 9pt;font-family:tahoma"><?php echo $ff1['moz']; ?></option>
				<?php } ?>
				</select>
			</td>
		</tr>
		<tr>
			<td class="label">
				<span>ناشـــــــــــر :</span>
			</td>
			<td >
				<input tabindex="5" type="text" name="nasher" value="<?php echo $v['nasher']; ?>" style="font-size: 10pt;font-family:tahoma">
			</td>
		</tr>
		<tr>
			<td class="label">
				<span>قيـــمت:</span>
			</td>
			<td >
				<input tabindex="6" type="text" size="8" name="price" value="<?php echo $v['price']; ?>" style="font-size: 10pt;font-family:tahoma">
				<input tabindex="7" type="text" size="8" name="price1" value="<?php echo $v['price1']; ?>" style="font-size: 10pt;font-family:tahoma">
			</td>
		</tr>
		<tr>
			<td class="label">
				<span>	تصوير كتاب :</span>
			</td>
			<td >
			    <input type="hidden" name="pic1" value="<?php echo $v['pic'];?>">
				<input tabindex="8" type="file" size="5" name="pic"  value="<?php echo $v['pic']; ?>">
			</td>
		</tr>
		<tr>
			<td  class="label">
				<span> محل نگهداري :</span>
			</td>
			<td >
				<input tabindex="9" type="text" size="10" name="m1" value="<?php echo $v['m1']; ?>" style="cursor:hand;font-size: 10pt;font-family:tahoma">
				<input tabindex="10" type="text" size="10" name="m2" value="<?php echo $v['m2']; ?>" style="cursor:hand;font-size: 10pt;font-family:tahoma">
			</td>
		</tr>
		<tr>
			<td class="label">
				<span >	توضيحات :</span>
			</td>
			<td >
				<input tabindex="11" type="text" size="30" name="tou" value="<?php echo $v['tou']; ?>" style="cursor:hand;font-size: 10pt;font-family:tahoma">
			</td>
		</tr>
		<tr>
			<td valign="top" class="label">
				<span>خلاصه کتاب :</span>
			</td>
			<td >
				<textarea name="kh_k" cols="30" rows="4" style="cursor:hand;font-size: 10pt;font-family:tahoma"><?php echo $v['kh_k']; ?></textarea>
			</td>
		</tr>
		<tr>
			<td class="label">
				<span >كد كنگره :</span>
			</td>
			<td >
			   <select tabindex="5" name="dio_ip" id="dio_ip" style="font-size: 9pt;font-family:tahoma">
				<?php
				    $f12=mysql_query("select * from dio ")or die(mysql_error());
				      while($ff12=mysql_fetch_assoc($f12)){
				      echo $ff12['code'];

				?>
				<option <?php if($ff12['code']==$v['dio_ip']){ ?> selected <?php }?>  value="<?php echo $ff12['code']; ?>" style="font-size: 9pt;font-family:tahoma"><?php echo $ff12['code'].' '.$ff12['name']; ?></option>
				<?php } ?>
			   </select>


			</td>
		</tr>
		<tr>
			<td colspan="2" align="center">
				<table>
					<tr>
						<td>
							<button tabindex="13" title="اصلاح" name="esla" type="submit" onClick="return emptyValidation('name~writer~topic')"><img src="images/b_edit.png"  name="eslah"  border="0" width="20" height="20" ></button>
						</td>
						</form>
						<form method="post" action="index1.php?page=two">
						<td>
							<button tabindex="14" title="بازگشت" name="cancel" type="button" onClick="ajaxload('bookpage.php')"><img src="images/r1.png"  name="eslah"  border="0" width="20" height="20" ></button>
						</td>
					</tr>
				</table>
			</td>
		</tr>
		</tr>
	</table>
</fieldset>
</div>
	</td>
	</tr>
	</table>
	</form>
	<?php

}
elseif($mode=="delete")
{
	//include ('header.php');
	 $q=$_GET[q2];
	$fg=mysql_query("select * from `ketab` where (ketab.ip='$q')");
	$v=mysql_fetch_assoc($fg);
	$pic=$v['pic'];
	?>
	<table dir="rtl" width="750" border="0" align="center">
	<tr>
	<td>
			<?php if($pic!=''){?><img  width="150" height="150"  src="books/<?php echo $pic;?>"><?php }?>
	</td>
	<td align="center">
	 <div class="divfieldset">
	<fieldset style="width:400px"><legend align="right" >حذف مشخصات كتاب </legend>
	<table align="center" border="0" dir="rtl" class="table" >
	<form name="uy" method="post" action="index1.php?page=two">
	<input type="hidden" name="ip" value="<?php echo $v['ip'];?>">
		<tr>
			<td width="200" class="label">
				<span>
				<input type="hidden" name="id" value="<?php echo $v['id']; ?>">
				شماره ثبت كتاب          :
				</span>
			</td>
			<td width="200" >
				<span class="blacktext">
				<?php
				echo $v['id'];
				?>
				</span>
			</td>
		</tr>
		<tr>
			<td class="label">
				<span>
				نــــــــام كتاب        :</span>
			</td>
			<td >
				<span class="blacktext">
				<?php
				echo $v['name'];
				?>
				</span>
			</td>
		</tr>
		<tr>
			<td class="label">
				<span >
				<input type="hidden" name="lname" value="	<?php
				echo $v['writer'];
				?>">
				نـــــام نويسنده:
				</span>
			</td>
			<td >
				<span class="blacktext">
				<?php
				echo $v['writer'];
				?>
				</span>
			</td>
		</tr>
		<tr>
			<td class="label">
				<span>نـــــام مترجـم :</span>
			</td>
			<td>
				<span class="blacktext">
				<?php
				echo $v['motarjem'];
				?>
				</span>
			</td>
		</tr>
		<tr>
			<td class="label">
				<span>موضـــــــــوع :</span>
			</td>
			<td>
				<span class="blacktext">
				<?php
				echo $v['topic'];
				?>
				</span>
			</td>
		</tr>
		<tr>
			<td class="label">
				<span>ناشـــــــــــر :</span>
			</td>
			<td >
				<span class="blacktext">
				<?php
				echo $v['nasher'];
				?>
				</span>
			</td>
		</tr>
		<tr>
			<td class="label">
				<span>قيمـــت :</span>
			</td>
			<td>
				<span class="blacktext">
				<?php
				echo $v['price']."-".$v['price1'];
				?>
				</span>
			</td>
		</tr>
		<tr>
			<td class="label">
				<span>محل نگهداري:</span>
			</td>
			<td>
				<span class="blacktext">
				<?php
				echo $v['m1']."-".$v['m2'];
				?>
				</span>
			</td>
		</tr>
		<tr>
			<td class="label">
				<span>
				توضيحات        :</span>
			</td>
			<td>
				<?php
				echo $v['tou'];
				?>
			</td>
		</tr>
		<tr>
			<td class="label">
				<span>
				خلاصه کتاب       :</span>
			</td>
			<td>
				<?php
				echo $v['kh_k'];
				?>
			</td>
		</tr>
		<tr>
			<td colspan="2" align="center">
				<table>
					<tr>
						<td>
							<button tabindex="1" title="حذف" name="dell" type="button" onClick="dele('a_bookpage.php','<?php echo $q;?>',ajaxload('bookpage.php'))"><img src="images/b_drop.png"  name="del"  border="0" width="20" height="20" ></button>
						</td>
						</form>
						<form method="post" action="index1.php?page=two">
						<td>
							<button tabindex="2" title="بازگشت" name="cancel" type="button" onClick="ajaxload('bookpage.php')"><img src="images/r1.png"  name="eslah"  border="0" width="20" height="20" ></button>
						</td>
					</tr>
				</table>
			</td>
		</tr>
		</tr>
	</form>
	</table>
	</fieldset>
</div>
	</td>

	</tr>
	</table>
	<?php
		//include ('foteer.php');
}
elseif (($_GET['new'])||($_SESSION[m]=='1') )
{
?>

<form name="uy" method="post"  action="a_bookpage.php" enctype="multipart/form-data">
	<table width="750" border="0" align="center" dir="rtl">
			<tr>
				<td align="center">
				   <div class="divfieldset">
	                 <fieldset style="width:400px"><legend align="right" >ثبت مشخصات كتاب </legend>
					<table align="center" border="0" dir="rtl"  class="tabel">
							<input name="city" type="hidden" value="<?php echo $_SESSION[city];?>">
								<tr>
									<td class="label">
										<span>  *	شماره ثبت كتاب          :</span>
									</td>
									<td>
										<input tabindex="1" type="text"  name="id" id="id"  onBlur="rep(this.id,'a_bookpage.php','d2')">
									     <div id="d2"></div>
									</td>
								</tr>
								<!--
								<tr>
									<td class="label">
										<span>  انتخاب گروه          :</span>
									</td>
									<td>
										<select tabindex="2" name="sath" id="sath" onchange="groupbok(this.value)"  style="font-size: 9pt;font-family:tahoma">
											<option value="1" style="font-size: 9pt;font-family:tahoma">یک</option>
											<option value="2" style="font-size: 9pt;font-family:tahoma">دو</option>
											<option value="3" style="font-size: 9pt;font-family:tahoma">سه</option>
										</select>
										<div id="tafodiv77" >
	       								</div>
									</td>
								</tr>
								!-->
								<tr>
									<td class="label">
										<span>  *	نــــــــام كتاب        :</span>
									</td>
									<td>
										<input tabindex="2" type="text" size="20" name="name" id="name" style="cursor:hand;font-size: 10pt;font-family:tahoma">
									</td>
								</tr>
								<tr>
									<td class="label">
										<span>  *	نـــــام نويسنده:</span>
									</td>
									<td>
										<input tabindex="3" type="text"  name="writer" id="writer"  style="cursor:hand;font-size: 10pt;font-family:tahoma">
									</td>
								</tr>
								<tr>
									<td class="label">
										<span> 	نـــــام مترجـم :</span>
									</td>
									<td>
										<input tabindex="4" type="text"  name="motarjem"  style="cursor:hand;font-size: 10pt;font-family:tahoma">
									</td>
								</tr>
								<tr>
									<td class="label">
									<span>  *	موضـــــــــوع :</span>
									</td>
									<td>
										<select tabindex="5" name="topic" id="topic" style="font-size: 9pt;font-family:tahoma">
										<option value="" style="font-size: 9pt;font-family:tahoma">انتخاب نماييد</option>
										<?php
										$f1=mysql_query("select * from mozo ");
										while($ff1=mysql_fetch_assoc($f1)){ ?>
											<option value="<?php echo $ff1['moz']; ?>" style="font-size: 9pt;font-family:tahoma"><?php echo $ff1['moz']; ?></option>
										<?php } ?>
										</select>
									</td>
								</tr>
								<tr>
									<td class="label">
									<span> 	ناشـــــــــــر :</span>
									</td>
									<td>
										<input tabindex="6" type="text" name="nasher" style="cursor:hand;font-size: 10pt;font-family:tahoma">
									</td>
								</tr>
								<tr>
									<td class="label">
									<span>	قيمــــت :</span>
									</td>
									<td>
										<input tabindex="7" type="text" size="8" name="price" style="cursor:hand;font-size: 10pt;font-family:tahoma">
										<input tabindex="8" type="text" size="8" name="price1" style="cursor:hand;font-size: 10pt;font-family:tahoma">
									</td>
								</tr>
								<tr>
									<td class="label">
									<span>	تصوير كتاب :</span>
									</td>
									<td>
										<input tabindex="9" type="file" size="5" name="pic" style="cursor:hand;font-size: 10pt;font-family:tahoma">
									</td>
								</tr>
								<tr>
									<td class="label">
									<span> محل نگهداري :</span>
									</td>
									<td>
										<input tabindex="10" type="text" size="10" name="m1" style="cursor:hand;font-size: 10pt;font-family:tahoma">
										<input tabindex="11" type="text" size="10" name="m2" style="cursor:hand;font-size: 10pt;font-family:tahoma">
									</td>
								</tr>
								<tr>
									<td class="label">
									<span>	توضيحات :</span>
									</td>
									<td>
										<input tabindex="12" type="text" size="30" name="tou" style="cursor:hand;font-size: 10pt;font-family:tahoma">
									</td>
								</tr>
								<tr>
									<td valign="top" class="label">
									<span>خلاصه کتاب :</span>
									</td>
									<td>
									<textarea name="kh_k" cols="30" rows="4" style="cursor:hand;font-size: 10pt;font-family:tahoma"></textarea>
									</td>
								</tr>
								<tr>

									 <td align="right" colspan="2">
									   <table>
									    <tr>
									      <td  class="label">
									<span>كد كنگره</span>

									 </td>
									      <td>
									      <input type="text" tabindex="1" size="10" name="txtdio" onKeyUp="getdio(this.value)">
									      </td>
										  <td>
										<div id="diodiv" >
													<select name="dio" id="dio"  width="120" tabindex="<?php echo $tab1; ?>" class="drop" >
														<option value=''>انتخاب نماييد</option>
													<?php
														$q1=mysql_query("select * from dio ");
														while($n1=mysql_fetch_array($q1)){
														echo "<option value=$n1[code]><span class='blacktext'>".$n1[name]." ".$n1[code]." </span></option>";
														}
														?>
													</select></div>
                                        </td>
										</tr>
									   </table>


									</td>
								</tr>
								<div id="d1"></div>
								<tr>
									<td colspan="2" align="center">
										<table>
											<tr>
												<td>
													<button tabindex="14" name="ffg" type="submit" onClick="return emptyValidation('id~name~writer~topic')"><img src="images/sabtf2.png"  name="neew"  border="0" width="20" height="20" ></button>
												</td>

												<td>
	          										<button tabindex="15" title="بازگشت" name="cancel" type="button"  onClick="ajaxload('bookpage.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
}
}
else
include('index.php');
?>
</body>
</html>