HEX
Server: Apache/2.4.58 (Ubuntu)
System: Linux ip-172-31-18-78 6.17.0-1017-aws #17~24.04.1-Ubuntu SMP Tue May 26 21:09:53 UTC 2026 aarch64
User: ubuntu (1000)
PHP: 8.2.31
Disabled: NONE
Upload Files
File: /var/www/nclive/technc/region_wise_report.php
<?php include 'header.php'; ?>
<style>

table,th,td{
     text-align: center;
    background-color: white;   
}

.col_1 {
        padding: 16px 10px 12px;
    font-family: "Source Sans Pro", "Open Sans", "Helvetica Neue", Helvetica, Arial, sans-serif;
    font-size: 15px;
    font-weight: 600;
    text-transform: uppercase;
    border-bottom: 1px solid #ddd;
    border-top: 0;
    background-color: #f9eae8;
    
}
.col_2{
      padding: 6px 8px;
      border-top: 1px solid #f0f0f0;
      line-height: 1.42857143;
      vertical-align: top;
      text-align: center;
      text-transform: capitalize;
      border-collapse: collapse;    
      font-family: "Open Sans", "Helvetica Neue", Helvetica, Arial, sans-serif;

}
.heading_contains{
    margin-bottom: 15px;
    font-weight: 600;
    font-size: 15px;
    color: #8c8c8c;
    text-transform: uppercase;
}
.form_search{float:right;
    margin-top: -19px;
    margin-right: 45px;
    font-weight: 600;
    font-size: 16px;
    color: #8c8c8c;
    
}
</style>

<?php
$date = date('Y-m-d');
$query1 = "SELECT region FROM sp_track_visitors where region!='' AND country='IN' group by region";
$sql1=$db->prepare($query1);
$sql1->execute();
if(isset($_REQUEST['submit'])){
    $date=$_REQUEST['d1'];

 $query = "SELECT region ,visit_date, visit_page,count(id) as total FROM sp_track_visitors where DATE_FORMAT(visit_date,'%Y-%m-%d')='$date' AND country='IN' group by region order by (total) DESC";
 
 $queryUniq = "SELECT count(distinct(session_id)) as unqSes FROM sp_track_visitors where DATE_FORMAT(visit_date,'%Y-%m-%d')='$date' AND country='IN' ";

// $sql=$db->prepare($query);
// $sql->execute();
}
else { 
	$query = "SELECT region ,visit_date, visit_page,count(id) as total FROM sp_track_visitors where DATE_FORMAT(visit_date,'%Y-%m-%d')='$date' AND country='IN' group by region order by (total) DESC";

	$queryUniq = "SELECT count(distinct(session_id)) as unqSes FROM sp_track_visitors where DATE_FORMAT(visit_date,'%Y-%m-%d')='$date' AND country='IN' ";

}
$sql=$db->prepare($query);
$sql->execute();

$sqlUnq=$db->prepare($queryUniq);
$sqlUnq->execute();

$number_of_rows = $sqlUnq->fetchColumn(); 

//echo $sqlUnq->num_rows();

?>
 <main id="main-container">
    <h2>Region Wise Report &nbsp;</h2>

    <form method="post" action="">
        <table>
            <tr> 
        <!-- ****** Search By Between Dates ****** -->
                <td width="60%" height="52px;">    
                     <input type="date" name="d1" value=""/>                         
                <input type="submit" value="Search" name="submit"/>
                </td>
            </tr>
        </table>
    </form>


    <div class="content content-narrow" ></style>

        <div class="row">
           
            <div class="col-md-12">
        <table class="t1" width="100%">
           
            <tr style="border-bottom: 1px solid #ddd; background-color: #f9eae8; border-top:0px;">
                <th class="col_1" >S.no</th>
                <th class="col_1" >Region Name</th>
                <th class="col_1" >Count</th>
            </tr>
             <?php
                $i=1;
                $sum=0;
                 while($row=$sql->fetch()){ ?>
            <tr>
                <?php $sum+= $row['total']; ?>
                <td class="col_2"><?php echo $i;?></td>
                <td class="col_2"><?php echo $row['region']; ?></td>
                <td class="col_2"><?php echo $row['total']; ?></td>
            </tr>
             <?php $i++; } ?>
            <tr>
                <td class="col_2">&nbsp;</td>
                <td class="col_2">Total Session</td>
                <td class="col_2"><?php echo $sum; ?></td>
            </tr>
			<tr>
                <td class="col_2">&nbsp;</td>
                <td class="col_2">Unique Session</td>
                <td class="col_2"><?php echo $number_of_rows; ?></td>
            </tr>
       </table>
    
</div>
</div>
</div>
</main>

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