<?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>
<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>";
		   ?>
	</div>
<?php
if (isset($_POST['darkhasti']))
{
	include_once('jdf.php');
   	$d16=jdate('Y/m/d');

	if ($_POST['lname']!=="" and $_POST['tell']!=="")
	{
	mysql_query("insert into `hand_book_darkhasti` (date,lname,tell,mail,user)
	VALUES ('{$d16}','{$_POST['lname']}','{$_POST['tell']}','{$_POST['mail']}','{$_SESSION['user']}')");

	echo"<script>alert('درخواست شما ثبت شد ، با شما تماس حاصل خواهد شد');</script>";
	}
	else
	echo"<script>alert('اطلاعات به صورت کامل وارد نشده و قابل ارسال نیست');</script>";
}
if ($_GET['kin']==1 or $_POST['kind']==1)
{
	$titr1="لیست نسخ خطی";
	$kin=1;
	$nam="نام کتاب";
	$widt="80%";
	$phf=4;
}
elseif ($_GET['kin']==2 or $_POST['kind']==2)
{
	$titr1="لیست مقالات";
	$kin=2;
	$nam="عنوان مقاله";
	$widt="50%";
	$phf=5;
}
?>
 <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><?php echo $titr1; ?></b></span><br/>
		<?php
		if (isset($_GET['idp']) and $_GET['kin']==1)
		{
		$fg166=mysql_query("select * from hand_book where (ip='{$_GET['idp']}' and city='{$_SESSION['city']}'  and kind='{$_GET['kin']}') order by name ");
		$v166=mysql_fetch_assoc($fg166);
		?>
		<table align="center" width="<?php echo $widt; ?>" border="1" dir="rtl"  bgcolor="#FFFFFF" style="font-family:B Nazanin;font-size:14pt">
			<tr>
				<td align="center" colspan="10">
					<b>
					درخواست کتاب :
					<span style="color:red" >
					<?php echo $v166['name']; ?>
					</span>
					</b>
				</td>
			</tr>
			<tr>
				<td align="right" colspan="10">
					لطفاً مشخصات خود را درج فرمایید:
				</td>
			</tr>
			<form action="book3.php?kin=1&&phf=<?php echo $phf; ?>" method="post">
			<tr>
				<td align="right">
					نام و نام خانوادگی:
					<input name="lname" type="text" size="25" tabindex="1">
				</td>
				<td align="right">
					شماره تلفن:
					<input name="tell" type="text" size="25" tabindex="1">
				</td>
				<td align="right">
					ایمیل:
					<input name="mail" type="text" size="25" tabindex="1">
				</td>
			</tr>
			<tr>
				<td colspan="10">
				<table width="100%" align="center">
				<tr>
				<td align="left"  width="50%" colspan="10">
					<button tabindex="1" title="تأیید و ارسال اطلاعات" name="darkhasti" type="submit"  >
					<img src="images/sabtf2.png"  name="back"  border="0" width="30" height="30" >
					</button>
				</td>
				</form>
				<td align="right">
					<button tabindex="1" title="بازگشت" name="m" type="button" onClick="location.href='book3.php?kin=1&&phf=<?php echo $phf; ?>'" >
					<img src="images/r1.png"  name="back"  border="0" width="30" height="30" >
					</button>
				</td>
				</tr>
				</table>
				</td>
			</tr>
		</table>
		<?php
		}
		?>
		<table align="center" width="<?php echo $widt; ?>" border="0" dir="rtl">
			<tr>
				<form name="ee" action="book3.php?kin=<?php echo $kin; ?>&&phf=<?php echo $phf; ?>" method="post">
			<input name="kind" type="hidden" value="<?php echo $kin; ?>">
			<td align="center" colspan="12" dir="rtl" width="45%">
				<select tabindex="1" name="seerch" style="font-size:10pt;font-family:tahoma">
					<option value="" style="font-size: 9pt;font-family:tahoma">جستجو براساس</option>
					<?php if ($_GET['kin']==1 or $_POST['kind']==1) {?>
					<option value="name" style="font-size: 9pt;font-family:tahoma">نام کتاب</option>
					<?php } if ($_GET['kin']==2 or $_POST['kind']==2) {?>
					<option value="name" style="font-size: 9pt;font-family:tahoma">عنوان مقاله</option>
					<?php } ?>
				</select>
					<input tabindex="2" dir="rtl" name="sear" type="text" style="font-family:Tahoma;font-size:10pt" 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:Tahoma;font-size:9pt;width:90px">
			</td>
			</form>
			</tr>
			<tr style="font-family:B Nazanin" bgcolor="<?php echo $_SESSION[backheader]; ?>">
			 	<?php
				if ($_GET['kin']==1 or $_POST['kind']==1)
				{
				?>
				<td align="center" width="5%"><b>درخواست کتاب</td>
			 	<?php
				}
				?>
				<td align="center" width="5%"><b>رديف</td>
			 	<td align="center"><b><a href="book3.php?forder=name&&kin=<?php echo $kin; ?>&&phf=<?php echo $phf; ?>" style="color:black;text-decoration:none"><?php echo $nam; ?></td>

			 	<?php
					if ($_GET['kin']==1 or $_POST['kind']==1)
					{
					?>
					<td align="center" width="30%"><b>توضیحات</td>
					<td align="center" width="10%"><b>تصویر 1</td>
					<td align="center" width="10%"><b>تصویر 2</td>
					<td align="center" width="10%"><b>تصویر 3</td>
					<?php
					}
					elseif ($_GET['kin']==2 or $_POST['kind']==2)
					{
					?>
					<td align="center" width="10%"><b>PDF</td>
					<td align="center" width="10%"><b>Word</td>
					<?php
					}
					?>
 			</tr>
 			<?php

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

				if ($_GET['kin']==1 or $_POST['kind']==1)
				$fg=mysql_query("select * from `hand_book` where (city='{$_SESSION['city']}'  and kind='{$kin}')  order by ip");
				elseif ($_GET['kin']==2 or $_POST['kind']==2)
				$fg=mysql_query("select * from `hand_book` where (city='{$_SESSION['city']}'  and kind='{$kin}')  order by ip");

				$nume=mysql_num_rows($fg);

				if (isset($_POST['sear']))
				{
					$qq=$_POST['sear'];

					if ($_POST['seerch']=='name')
					{
					$q='name';
					$fg=mysql_query("select * from hand_book where ($q like'%$qq%' and city='{$_SESSION['city']}' and kind='{$kin}') order by name");
					}
				}
				else
				$fg=mysql_query("select * from hand_book where (city='{$_SESSION['city']}'  and kind='{$kin}') order by name ");

				$i=1;
				while($v=mysql_fetch_assoc($fg))
				{
				$ipp=$v['ip'];
//				$fg1=mysql_query("select * from hand_book where (city='{$_SESSION['city']}' and id='{$v['id']}') order by id ");
//				$v11=mysql_fetch_assoc($fg1);
				?>
			<tr align="center"  style="font-family:B Nazanin;font-size:13pt" onmouseover="this.style.backgroundColor='<?php echo $_SESSION[backheader];?>';" onmouseout="this.style.backgroundColor='<?php echo $color[$a]; ?>';"  bgcolor=<?php echo $color[$a]; ?>>
				<?php
				if ($_GET['kin']==1 or $_POST['kind']==1)
				{
				?>
				<td>
					<a title="درخواست کتاب" href="book3.php?idp=<?php echo $v['ip']; ?>&kin=<?php echo $_GET['kin']; ?>&&phf=<?php echo $phf; ?>">
					<img src="images/sabtf2.png" height="25" alt="نرم افزار کتابداری نوین" width="25">
					</a>
				</td>
				<?php
				}
				echo "</td><td>$i</td>
				<td style='font-family:B Nazanin;font-size:16pt'><span class:blacktext>".$v['name']."</td>";

				if ($_GET['kin']==1 or $_POST['kind']==1)
				{
				?>
				<td>
					<textarea name="tou" tabindex="1" readonly cols="35" rows="5" style="font-size:14pt;font-family:B Nazanin"><?php echo $v['tou']; ?></textarea>
				</td>
				<?php
				}
				?>
				<td style="font-family:B Nazanin;font-size:13pt">
					<?php
					if ($_GET['kin']==1 or $_POST['kind']==1)
					{
					?>
					شماره صفحه:<?php echo $v['matn1']; ?><br/>
					<div id="vlightbox1">
					<a target="_blank"  title="تصویر یک" href="uplowd/handbook/<?php echo $v['pic']; ?>">
					<img   height="150" alt="نرم افزار کتابداری" width="150" onmouseover="this.width=300;this.height=300" onmouseout="this.width=150;this.height=150"  src="uplowd/handbook/<?php echo $v['pic']; ?>">
					</a>
					</div>
					<?php
					}
					elseif ($_GET['kin']==2 or $_POST['kind']==2)
					{
					?>
					<a target="_blank" title="فایل یک" href="uplowd/maghale/<?php echo $v['pic']; ?>" >
					<img src="images/pdf.png" height="20" alt="نرم افزار کتابداری" width="20">
					<?php
					}
					?>

					</a>
				</td>
				<td style="font-family:B Nazanin;font-size:13pt">
					<?php
					if ($_GET['kin']==1 or $_POST['kind']==1)
					{
					?>
					شماره صفحه:<?php echo $v['matn2']; ?><br/>
					<a target="_blank" title="تصویر دو" href="uplowd/handbook/<?php echo $v['pic2']; ?>" >
					<img src="uplowd/handbook/<?php echo $v['pic2']; ?>" height="150" alt="نرم افزار کتابداری" width="150"  onmouseover="this.width=300;this.height=300" onmouseout="this.width=150;this.height=150">
					<?php
					}
					elseif ($_GET['kin']==2 or $_POST['kind']==2)
					{
					?>
					<a target="_blank" title="فایل دو" href="uplowd/maghale/<?php echo $v['pic2']; ?>" >
					<img src="images/word.png" height="20" alt="نرم افزار کتابداری" width="20">
					<?php
					}
					?>
					</a>
				</td>
				<?php
				if ($_GET['kin']==1 or $_POST['kind']==1)
				{
				?>
				<td style="font-family:B Nazanin;font-size:13pt">
					شماره صفحه:<?php echo $v['matn3']; ?><br/>
					<a target="_blank" title="تصویر سه" href="uplowd/handbook/<?php echo $v['pic3']; ?>" >
					<img src="uplowd/handbook/<?php echo $v['pic3']; ?>" height="150" alt="نرم افزار کتابداری" width="150"  onmouseover="this.width=300;this.height=300" onmouseout="this.width=150;this.height=150">
					</a>
				</td>
				<?php
				}
				echo "</span>";
				if($a==1) $a=0;  else $a=1;
				$i++;
				}
				?>
			</tr>
			<tr  bgcolor="<?php echo $_SESSION[backheader]; ?>" >
				<td colspan="12" >
					<?php
					if(!isset($_POST['sear']) and !$forder)
					include ('paging3.php');
					?>
				</td>
			</tr>
		</table>
	</td>
 </tr>
  <tr>
   <td id="header" ><?php  include ('foteer.php');?></td>
 </tr>
</table>
<?php
//}
//else
//include('index.php');
?>
