<?php
session_start();
//if($_SESSION[city]!="")
//{
include ('dbf.php');
?>
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>نرم افزار كتابداري و كتابخواني نوين</title>
</head>
</html>
<style type="text/css">
.style35 {
	font-size: 19px;
	color: #FFFFFF;
	font-family: Tahoma;
}
.style67 {
	color: #2470A3;
	font-family: upcib;
	font-size: 13px;
	src: url('../fonts/upcib.ttf');
}

</style>
<script src="ajax1.js"></script>
<table dir="ltr" align="center" border="0" style="padding-top:10px;background-repeat:no-repeat;width:100%"   >
 <tr>
   <td id="header"  valign="top" align="center"><?php  include_once ('header.php');?></td>
 </tr>

   	<div id="menu" align="center">
		  <?php
//		  if($_SESSION[onvan]=='عضو')
//			 include('menuozv.php');
//		  elseif($_SESSION[onvan]=='')
		  if($_SESSION[onvan]=='')
		  echo"<script>window.location='index.php'</script>";

		  $fg10=mysql_query("select * from book_group1 where (city='{$_SESSION['city']}')   ");
		  $v10=mysql_fetch_assoc($fg10);
		   ?>
	</div>

 <tr>
	<td height="700" width="100%" align="center" valign="top"  style="padding-top:10px;border-style:ridge;border-width:thick;padding-right:5px;padding-left:5px;border-color:#6D3E06">
		<span style="font-family:B Nazanin;font-size:17pt"><b>لیست کتاب ها</b></span><br/>
		<form name="ee" action="bookpage2.php?phf=1" method="post">
		<table align="center" width="90%" border="0" dir="rtl">
			<tr>
			<td align="center" colspan="15" dir="rtl" width="45%">
				<select tabindex="1" name="seerch" style="font-size:10pt;font-family:B Nazanin">
					<option value="" style="font-size: 9pt;font-family:B Nazanin">جستجو براساس</option>
					<option value="id" style="font-size: 9pt;font-family:B Nazanin">شماره ثبت كتاب</option>
					<option value="dio_ip" style="font-size: 9pt;font-family:B Nazanin">كد كنگره</option>
					<option value="name" style="font-size: 9pt;font-family:B Nazanin">نام کتاب</option>
					<option value="writer" style="font-size: 9pt;font-family:B Nazanin">نويسنده</option>
					<option value="motarjem" style="font-size: 9pt;font-family:B Nazanin">مترجم</option>
					<option value="topic" style="font-size: 9pt;font-family:B Nazanin">موضوع</option>
					<option value="nasher" style="font-size: 9pt;font-family:B Nazanin">ناشر</option>
					<option value="price" style="font-size: 9pt;font-family:B Nazanin">قيمت</option>
					<option value="sath" style="font-size: 9pt;font-family:B Nazanin">گروه1</option>
					<option value="sath1" style="font-size: 9pt;font-family:B Nazanin">گروه2</option>
				</select>
					<input tabindex="2" dir="rtl" name="sear" type="text" style="font-family:B Nazanin;font-size:12pt" value="فیلد جستجو" onfocus="if(this.value=='فیلد جستجو')   {this.value='';}"   onblur="if(this.value=='')   {this.value='فیلد جستجو';}">
					<input tabindex="3" dir="rtl" name="search" value="جستجو" type="submit" style="font-family:B Nazanin;font-size:12pt;width:90px">
			</td>
			</tr>
			<tr>
			<td align="left" colspan="5" dir="rtl" width="45%">
				<span  style="font-size:14pt;font-family:B Nazanin">
				گروه یک:
				<select tabindex="2" name="sath" id="sath" onchange="groupbok(this.value)"  style="font-size:12pt;font-family:B Nazanin">
					<option value="" style="font-size:14pt;font-family:B Nazanin">انتخاب فرمایید</option>
					<option value="1" style="font-size:14pt;font-family:B Nazanin"><?php echo $v10['name1'];?></option>
					<option value="2" style="font-size:14pt;font-family:B Nazanin"><?php echo $v10['name2'];?></option>
					<option value="3" style="font-size:14pt;font-family:B Nazanin"><?php echo $v10['name3'];?></option>
				</select>
			</td>
			<td colspan="2" align="center">
				<span  style="font-size:14pt;font-family:B Nazanin">
				گروه دو:
				<div id="tafodiv77" >
	       		</div>
	       	</td>
			<td colspan="10" align="right">
				<input tabindex="3" dir="rtl" name="search12" value="جستجو" type="submit" style="font-family:B Nazanin;font-size:12pt;width:90px">
			</td>
			</tr>
			<tr class="style67" style="font-family:B Nazanin;font-size:14pt;color:black" bgcolor="<?php echo $_SESSION[backheader]; ?>">
			 	<td align="center" width="2%">متن</td>
			 	<td align="center" width="2%">PDF</td>
			 	<td align="center" width="5%"><b>رديف</td>
			 	<td align="center" width="10%"><b><a href="bookpage2.php?forder=id&&phf=1" style="color:black;text-decoration:none">شماره ثبت كتاب</td>
			 	<td align="center" width="10%"><b><a href="bookpage2.php?forder=dio_ip&&phf=1" style="color:black;text-decoration:none">كد كنگره</td>
			 	<td align="center" width="20%"><b><a href="bookpage2.php?forder=name&&phf=1" style="color:black;text-decoration:none">نام</td>
			 	<td align="center"><b><a href="bookpage2.php?forder=writer&&phf=1" style="color:black;text-decoration:none">نويسنده</td>
			 	<td align="center"><b><a href="bookpage2.php?forder=motarjem&&phf=1" style="color:black;text-decoration:none">مترجم</td>
			 	<td align="center"><b><a href="bookpage2.php?forder=topic&&phf=1" style="color:black;text-decoration:none">موضوع</td>
			 	<td align="center"><b><a href="bookpage2.php?forder=nasher&&phf=1" style="color:black;text-decoration:none">ناشر</td>
			 	<!--
				<td align="center"><b><a href="bookpage2.php?forder=price" style="color:black;text-decoration:none">قيمت</td>
			 	<td align="center"><b><a href="bookpage2.php?forder=sath" style="color:black;text-decoration:none">گروه یک</td>
			 	<td align="center"><b><a href="bookpage2.php?forder=sath1" style="color:black;text-decoration:none">گروه دو</td>
			 	!-->
 			</tr>
 			<?php


				 $color=array($_SESSION['bgcolor'],$_SESSION['bgcolor1']); $a=0;
 				$forder=$_GET['forder'];
				$start=$_GET['start'];
				$page_name="bookpage2.php";
                if(strlen($start) > 0 and !is_numeric($start)){
                 echo "Data Error";
                 exit;
                 }
               	 $eu = ($start - 0);
                 $limit = 10;
                 $this1 = $eu + $limit;
   	             $back = $eu - $limit;
       	         $next = $eu + $limit;

				$fg=mysql_query("select * from `ketab` where (city='{$_SESSION['city']}')  order by id");
				$nume=mysql_num_rows($fg);

				if (isset($_POST['sear']) and isset($_POST['search']))
				{
					$qq=$_POST['sear'];
					if ($_POST['seerch']=='id')
					{
					$q='id';
					}
					if ($_POST['seerch']=='dio_ip')
					{
					$q='dio_ip';
					}
					if ($_POST['seerch']=='name')
					{
					$q='name';
					}
					if ($_POST['seerch']=='writer')
					{
					$q='writer';
					}
					if ($_POST['seerch']=='motarjem')
					{
					$q='motarjem';
					}
					if ($_POST['seerch']=='topic')
					{
					$q='topic';
					}
					if ($_POST['seerch']=='nasher')
					{
					$q='nasher';
					}
					if ($_POST['seerch']=='nasher')
					{
					$q='nasher';
					}
					if ($_POST['seerch']=='price')
					{
					$q='price';
					}
					if ($_POST['seerch']=='sath')
					{
					$q='sath';
					}
					if ($_POST['seerch']=='sath1')
					{
					$q='sath1';
					}
				$fg=mysql_query("select * from ketab where ($q like'%$qq%' and city='{$_SESSION['city']}') order by id");
				}
				elseif (isset($_POST['search12']))
				{
					if ($_POST['sath']>0 and $_POST['sath1']>0)
					$fg=mysql_query("select * from ketab where (sath='{$_POST['sath']}' and sath1='{$_POST['sath1']}' and city='{$_SESSION['city']}') order by id ");
					elseif ($_POST['sath']>0 and $_POST['sath1']=='')
					$fg=mysql_query("select * from ketab where (sath='{$_POST['sath']}' and city='{$_SESSION['city']}') order by id ");
					elseif ($_POST['sath']=='' and $_POST['sath1']>0)
					$fg=mysql_query("select * from ketab where (sath1='{$_POST['sath1']}' and city='{$_SESSION['city']}') order by id ");
				}
				else
				{
				if($forder)
	 			$fg=mysql_query("select * from ketab where (city='{$_SESSION['city']}') order by $forder ");
	 			else
				$fg=mysql_query("select * from ketab where (city='{$_SESSION['city']}') order by id limit $eu, $limit");
				}
				$i=1;
				while($v=mysql_fetch_assoc($fg))
				{
				$sathh1='';
				if ($v['sath']=='1')
				$sathh1=$v10['name1'].'-1';
				if ($v['sath']=='2')
				$sathh1=$v10['name2'].'-2';
				if ($v['sath']=='3')
				$sathh1=$v10['name3'].'-3';

				$fg18=mysql_query("select * from book_group where (ip='{$v['sath1']}' and city='{$_SESSION['city']}') order by id   ");
				$v18=mysql_fetch_assoc($fg18);

				$fg19=mysql_query("select * from amanat where (id_b='{$v['id']}' and date_in='0' and city='{$_SESSION['city']}') order by id   ");
				$v19=mysql_fetch_assoc($fg19);
				if ($v19['id'])
				{
				?>
			<tr align="center"  style="font-family:B Nazanin;font-size:15pt" title="<?php echo "کتاب در امانت عضو شماره :".$v19['id_ozv']."می باشد"; ?>" onmouseover="this.style.backgroundColor='<?php echo $_SESSION[backheader];?>';" onmouseout="this.style.backgroundColor='red';"  bgcolor="red" >
				<?php
				}
				else
				{
				?>
			<tr align="center"  style="font-family:B Nazanin;font-size:15pt" onmouseover="this.style.backgroundColor='<?php echo $_SESSION[backheader];?>';" onmouseout="this.style.backgroundColor='<?php echo $color[$a]; ?>';"  bgcolor=<?php echo $color[$a]; ?>>
				<?php
				}
				$fg11=mysql_query("select * from `matn` where (id='{$v['id']}' and city='{$_SESSION['city']}'  and !(name=' '))  order by id");
				$v11=mysql_fetch_assoc($fg11);
				$ipp=$v11['ip'];
				echo "<td>";
				if ($v11['id'])
				{ ?>
				<a target="_blank" href="textpage2.php?matn=<?php echo $ipp; ?>&&phf=1" ><img src="images/12.png"  height="20" alt="نرم افزار کتابداری" width="20">
				<?php
				}
				echo "</td>";

				$fg12=mysql_query("select * from `matn` where (id='{$v['id']}' and city='{$_SESSION['city']}'  and !(up_book=' '))  order by id");
				$v12=mysql_fetch_assoc($fg12);

				echo "<td>";
				if ($v12['id'])
				{ ?>
				<a target="_blank" href="books/<?php echo $v12['up_book']; ?>" >
					<img src="images/pdf.png" height="20" alt="نرم افزار کتابداری" width="20">
				</a>
				<?php
				}
				echo "</td>";

				echo "<td>$i</td>
				<td><span class:blacktext>".$v['id']."</td>
				<td><span class:blacktext>".$v['dio_ip']."</td>
				<td><span class:blacktext>".$v['name']."</td>
				<td><span class:blacktext>".$v['writer']."</td>
				<td><span class:blacktext>".$v['motarjem']."</td>
				<td><span class:blacktext>".$v['topic']."</td>
				<td><span class:blacktext>".$v['nasher']."</td></span>";
//				echo "<td><span class:blacktext>".$v['price']."</td>
//				<td><span class:blacktext>".$sathh1."</td>
//				<td><span class:blacktext>".$v18['name'].'-'.$v18['id']."</td>
//				</span>";

				if($a==1) $a=0;  else $a=1;
				$i++;
				}

				?>
			</tr>
			<tr  bgcolor="<?php echo $_SESSION[backheader]; ?>" >
				<td colspan="15" >
					<?php
					if(!$forder)
					include ('paging3.php');
					?>
				</td>
			</tr>


			<tr style="font-family:B Nazanin;font-size:11pt" bgcolor="red">
				<td colspan="10" align="right">
					<span><b>
					*کتاب هایی که قرمز رنگ است ، در امانت اعضاء می باشد و در حال حاضر در کتابخانه موجود نیست.
					</span>
				</td>
			</tr>
		</table>
		</form>
	</td>
 </tr>
 <tr>
   <td id="header" ><?php  include ('foteer.php');?></td>
 </tr>
</table>
<?php
//}
//else
//include('index.php');
?>
