<?php 
include 'header.html';
$root = $_SERVER['DOCUMENT_ROOT'];
$search = $_GET['q'];
if (isset($search)){
	$_SESSION['lastsearch'] = $search;
$ip = $_SERVER['REMOTE_ADDR'];
$sql  = $dbh->prepare("insert into search (ip_address,searchterm,dateofsearch) 
	values ('$ip','$search',now())");
$sql->execute();


    }




?>


<script type="text/javascript" src="tipuesearch/tipuesearch.min.js"></script>
<script>

window.onbeforeunload = function() {
	//ajax!!!!
	var lastFlight = window.location.href;
	console.log(lastFlight);

	var location = lastFlight.split('=');
	var city = location[1]; 

    return "Your flight to " + city + " just went down $300";
};

</script>
<div class="row">
	<div class="small-12 large-12 columns">
		<div id="tipue_search_content"></div>
	</div>
</div>

<?php include 'footer.html';?>

<script>
$(document).ready(function() {
     $('#tipue_search_input').tipuesearch({
          'mode': 'live',
          'liveDescription': '.norm'
     });
});
</script>

