
<?php
session_start();
include_once('../config/#Config.php');
if(!$_SESSION['UserName']){
die('<script>window.location.href=\''.$config['site']['url'].'index.php\';</script>');
}
$get_AD = mysqli_query($conn, "Select * From config_admin WHERE Account = '".$_SESSION['UserName']."'");
if(!mysqli_num_rows($get_AD)){
	die('Không đủ quyền.');
}

?>
 <div class="table-responsive">
                                        
                                        <table class="align-middle mb-0 table table-borderless table-striped table-hover">
                                            <thead>
                        <tr>
                         <th class="text-center">
                            #
                          </th>
                          <th class="text-center">
                            Tài khoản
                          </th>
                          <th class="text-center">
                            Máy Chủ
                          </th>
						 <th class="text-center">
                           Nhân Vật
                          </th>
						  <th class="text-center">
                           Nội Dung
                          </th>
						  <th class="text-center">
                            Số Dư Trước
                          </th>
						  <th class="text-center">
                            Số Dư Sau
                          </th>
						 <th class="text-center">
                            Thời Gian
                          </th>
                                            </tr>
                                            </thead>
                                            <tbody>
                                                <?php
                                             if($_REQUEST['query']){
                                                 $phantich = explode('&',$_REQUEST['query']);
                                                 for($i=0;$i<=count($phantich);$i++){
                                                         $phantichnew = explode('=',$phantich[$i]);
                                                         $_GET[''.$phantichnew[0].''] = $phantichnew[1];
                                                 }
                                                 if($_GET['keyword']){
                                                    $_REQUEST['keyword'] = $_GET['keyword'];
                                                 }
                                             }   
                                             $_GET['CauQuery'] = 'TimKiemQuery';
          include_once('paginator.class.jquery.php'); 
		$condition		=	"";
		if (isset($_REQUEST['keyword'])) {
  $keyword = $_REQUEST['keyword'];
  $qryStr="select * from logs_user Where UserName like '%$keyword%' OR Messager like '%$keyword%' order by ID DESC";
}else{
  $qryStr="select * from logs_user order by ID DESC";

}
        $country	=	mysqli_query($conn,$qryStr);
		$count		=	mysqli_num_rows($country);
		
        $pages = new Paginator($count,9);
		echo '<nav class="" aria-label="Page navigation example"> <ul class="pagination">';
		echo $pages->display_pages();
		echo '</ul></nav>';
		echo '</div>';
		echo '<div class="col-sm-6 text-right">';
		echo "<span class=\"form-inline\">".$pages->display_jump_menu().$pages->display_items_per_page()."</span>";
		echo '</div>';
		echo '<div class="clearfix"></div>';
		$limit	= $pages->limit_start.','.$pages->limit_end;
        $qry 	=	mysqli_query($conn, $qryStr.' LIMIT '.$limit);
        if($count>0){
            $n	=	1;
                       while($row	=	mysqli_fetch_array($qry, MYSQLI_ASSOC)){ 
                echo '<tr>
                        <td class="text-center">'.$n.'</td>
                        <td class="text-center" onClick="showpupuweb(\'lichsuall\',\''.$row['UserName'].'\');">'.$row['UserName'].'</td>
                        <td class="text-center">'.$row['Server'].'</td>
                        <td class="text-center">'.$row['PlayerID'].'</td>
                        <td class="text-center">'.$row['Messager'].'</td>
                        <td class="text-center"><span class="badge badge-warning">'.number_format($row['SoDuHC']).'</span></td>
                        <td class="text-center"><span class="badge badge-danger">'.number_format($doc['TienThat']).'</span></td>					 
                        <td class="text-center"><span class="badge badge-info">'.date('d-m-Y h:i:s',$row['Timer']).'</span></td>
                     </tr>';
            $n++;
            }
        }
    ?>
                                            </tbody>
                                        </table>
                                    </div>
