File: /var/www/nclive/technc/visitor_report.php
<?php
include 'header.php';
$count="select count(*) as total from sp_track_visitors";
$sql=$db->prepare($count);
$sql->execute();
$plus=$sql->fetch();
$countresult=$plus['total'];
/*** count query ***/
$max=100;
if(isset($_POST['dis'])){
echo $t=$_POST['dis'];}
$min=isset($_GET['page']) ? $_GET['page'] : 1;
$offset = ($min - 1) * $max;
$div= ceil($countresult / $max);
/*** end count query ***/
echo $query ="select * from sp_track_visitors where date (visit_date)='$t' limit $offset, $max";
$sql=$db->prepare($query);
$sql->execute();
?>
<!-- Main Container -->
<main id="main-container">
<form method="post">
date :<input type="date" name="dis" value="">
<input type="submit" name="submit" value="submit" width="148" height="148" >
</form>
<div class="content content-narrow">
<!-- Forms Row -->
<div class="row">
<div class="col-lg-12">
<!-- Bootstrap Forms Validation -->
<h2 class="content-heading">Visitor List</h2>
<div class="table-responsive">
<table class="table table-striped table-hover table table-striped table-hover text-capitalize table-condensed">
<thead>
<tr class="danger">
<th class="text-center">id</th>
<th class="text-center">refer_page</th>
<th class="text-center">visit_page</th>
<th class="text-center">ip_address</th>
<th class="text-center">browser</th>
<th class="text-center">country</th>
<th class="text-center">region</th>
<th class="text-center">city</th>
<th class="text-center">visit_date</th>
</tr>
</thead>
<?php $number=1;
$a = ($min - 1) * 30 + $number;
while($row=$sql->fetch()){
?>
<tr>
<td class="text-center"><?php echo $a; ?></td>
<td class="text-center"><?php echo $row['id']; ?></td>
<td class="text-center"><?php echo $row['refer_page']; ?></td>
<td class="text-center"><?php echo $row['visit_page']; ?></td>
<td class="text-center" ><?php echo $row['browser']; ?></td>
<td class="text-center"><?php echo $row['ip_address']; ?></td>
<td class="text-center"><?php echo $row['country']; ?></td>
<td class="text-center"><?php echo $row['region']; ?></td>
<td class="text-center"><?php echo $row['city']; ?></td>
<td class="text-center"><?php echo $row['visit_date']; ?></td>
</tr>
<?php $a++; } ?>
<tr class="danger">
<td colspan='6'><center>
<ul class="pagination">
<?php
$nextpage=$min+1;
$prevpage=$min-1;
if($prevpage!=0){
?>
<li class="page-item"><a class="page-link" id="prev" href="/visitor_report.php?page=<?php echo 1; ?>">First</a></li>
<li class="page-item"><a class="page-link" id="prev" href="/visitor_report.php?page=<?php echo $prevpage; ?>">Previous</a></li>
<?php }
for($d=1;$d<=$div;$d++){ ?>
<li class="page-item "><a class="page-link" href="/visitor_report.php?page=<?php echo $d; ?>"><?php echo $d; ?></a></li>
<?php }
if($nextpage<=$div){
?>
<li class="page-item"><a class="page-link" id="next" href="/visitor_report.php?page=<?php echo $nextpage; ?>">Next</a></li>
<li class="page-item"><a class="page-link" id="next" href="/visitor_report.php?page=<?php echo $div; ?>">Last</a></li>
<?php } ?>
</ul></center>
</td>
<td colspan='2'><?php echo $plus; ?></td>
</tr>
</table>
</div>
</div>
</div>
</div>
</div>
</main>
<?php include 'footer.php'; ?>
<!-- END Main Container -->