<?php
session_start();
ob_start();
require_once './configs/webconfig.php';
require_once './utility/common_model.php';

require_once './controller/admin_controller.php';

$MyPdodb = new MyPDO();	

		$MyPdodb->setAttribute(PDO::ATTR_STATEMENT_CLASS, array('MyPDOStatement'));		
		
		
		 $sql = $_SESSION["sess_sql"];
		
				$stm  = $MyPdodb->prepare($sql);      		
				$stm->execute(array($start,$limit));
				$results = $stm->fetchAll(PDO::FETCH_CLASS);
				
				
				
				$exportData = $results;
?>

<?php
	$totalHours =0;
	if(count($exportData)> 0) {
		foreach ($exportData as $project) { 	
			$totalHours += 	$project->hours;	
		}
	}
?>
    <table class="" width="100%" border="0">	                
                  <?php  if(count($exportData)> 0) {?>   
                 
                                 
      				<tr>
                    <td align="center" valign="top">                         
                        <table class="bordered-table zebra-striped dataTable" width="100%" id="datagrid">                        
                         <thead>
                          <tr>                            
                            <th class="header srnoTd"><strong>Sr.No.</strong></th>
                            <th class="header"><strong>Ip Address</strong></th>
							<th class="header"><strong>Country</strong></th>
							<th class="header"><strong>Web URL</strong></th>
							<th class="header"><strong>Date Time</strong></th>
                          </tr>
                        </thead>                     
                         <tbody>
						   <?php				  
                           $i=$start;						   
                          foreach ($exportData as $section) { 
						
                            $i++;				  							              
                          ?>
                          <tr>
                             <td ><?php echo $i?></td>
                             <td ><?php echo $section->ipadd?></td>
							 <td ><?php echo $section->country?></td>
							 <td ><?php echo $section->weburl?></td>
							 <td ><?php echo $section->dttime?></td>
                          </tr>                                             
                          <?php
                           }
                          ?>   
                                     
                      </tbody>
                    </table>
                   
        </td>
                </tr>                 
                  <?php  }else{ ?>
                  <tr >
                    <td align="center">
                         <div class="col-lg-6 alert alert-danger" style="clear:right; float:none">
                            No records found.
                         </div>   
                    </td>
                  </tr>
                 <?php } ?>                  
              </table>   
<?php
$filename = "JPC-Bannerclicks-".$_SESSION["sess_title"]."-".date("dmY").".xls";
header( "Content-Type: application/vnd.ms-excel" );
header("Content-Disposition: attachment; filename=$filename");
header("Pragma: no-cache");
header("Expires: 0");
ob_flush();
?>