<?php include 'header.html';?>
<?php include 'slider.html';?>
<h1>Your Recent Searches</h1>
<?
$lastpage = $_SERVER['HTTP_REFERER'];
echo "lastpage is ".$_SESSION['lastsearch'];
if (eregi('search.html',$lastpage)){
$time = mktime();
header ("Location: index.html?time=" + $time);
}

$ip = $_SERVER['REMOTE_ADDR'];
$sql = $dbh->prepare("select * from search where ip_address = '$ip' order by dateofsearch desc limit 5");
$sql->execute();
while ($row = $sql->fetch()){
echo '<a href="search.html?q='.$row['searchterm'].'">'.$row['searchterm'].'</a><br>';

}

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