<?php
   require('includes/common.php');
	include_once $config['SiteClassPath']."class.Staff.php";
   	include_once $config['SiteClassPath']."class.book.php";
	include_once $config['SiteClassPath']."class.headerclass.php";
	include_once $config['SiteClassPath']."class.split_page_results.php";
    $objbook		= new book();
	$Objheaderclass	= new headerclass();
	// $objStaff	= new Staff();
  	// 	$objStaff->chkStaffLogin();
	  $objStaff	= new Staff();
	  $objStaff ->chkStaffLogin($objArray);
	if(isset($_GET['category']))
	{
  		$objbook->Getbooks($_GET);
	}
	//$objStaff		= new Staff();

	
	if(isset($_POST['search']))
	{
	//echo $_POST['search_value'];
  		$objbook->GetAuthorbooks($_POST['search_value']);
		
	}



	//echo $_POST['search_value'];
  		$objbook->GetAuthorbooks($objArray);
		
	
	  if(isset($_POST['search_value']))
	{
	//echo $_POST['search_value'];
  		//$Objheaderclass->Getbooksheader($_POST['search_value']);
		$var=$_POST['search_value'];
	header("Location: bookpage.php?bname=$var");
	}

	if(isset($_POST['pass']))
	{
	//echo $_POST['pass'];
  		$Objheaderclass->updatepass($_POST['pass']);
	}
		if(isset($_POST['pass2']))
	{
	//echo $_POST['pass2'];
  		$Objheaderclass->loginpass($_POST['pass2']);
	}
	if(isset($_POST['hdAction2']))
	{
  if(isset($_SESSION['login_user']))
	{
        //session is set
		//echo $_SESSION['login_user'];
		$objheaderclass->InsertCart($_POST['b_id']);
		echo '<script language="javascript">';
		echo 'alert("Added to cart successfully!!!")';
		echo '</script>';
    }
	 else if(!isset($_SESSION['login_user']))
	{ //echo "not";
        //session is not set
		echo '<script language="javascript">';
		echo 'alert("Please Login!!!")';
		echo '</script>';
        //header('Location:' .$_SERVER['PHP_SELF'].'');
    }
	}

   $objbook->weekauthor();
   $objbook->category();
  $objSmarty->assign('IncludeTpl', 'newBooks.tpl');
  $objSmarty->assign('OverallSiteTitle', $config['SiteTitle'].' -::-Aura -::- SCADA');
  $objSmarty->assign('document-state','dynamic');
  $objSmarty->assign('address',$config['SiteGlobalPath']);
 //	$objSmarty->assign('address','http://www.tasca.in');
  

							   
							   
			 /*Display page*/
  $objSmarty->assign('HeaderTpl', 'header.tpl');
  $objSmarty->assign('FooterTpl', 'footer.tpl');
  $objSmarty->display('pagetemplate.tpl');
?>