<?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.');
}
if(!is_numeric($_POST['id'])){
		die('ID không hợp lệ.');
} else {
$getitem_code = mysqli_query($conn, "Select * From logs_user WHERE ID = '".$_POST['idevent']."' ORDER BY ID DESC");
if(mysqli_num_rows($getitem_code)){
	$i=0;
	while($row = mysqli_fetch_array($getitem_code, MYSQLI_ASSOC)){
		$i++;
		if($row['Item_Text'] == 'Gold' or $row['Item_Text'] == 'Coin' or $row['Item_Text'] == 'VipExp' or $row['Item_Text'] == 'Exp' or $row['Item_Text'] == 'Honor' or $row['Item_Text'] == 'Contrib'){
			$Name = getnameText($row['Item_Text']);
			$Count = number_format($row['Count_B']);
		} else {
		$getName = mysqli_fetch_array(mysqli_query($conn, "Select Name From Item_Goods WHERE ItemID = '".$row['ItemID']."'"), MYSQLI_ASSOC);
			$Name = $getName['Name'];
			$Count = number_format($row['Count_A']);		
		}
		echo '<tr>
                          <td class="font-weight-medium">
                           '.$i.'
                          </td>
                          <td>
                            '.$Name.'
                          </td>	
                          <td>
                            '.$Count.'
                          </td>							  
                         <td>
                      <div class="ticket-actions col-md-2">
                        <div class="btn-group dropdown">
                          <button type="button" class="btn btn-success dropdown-toggle btn-sm" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
                            Tùy chọn
                          </button>
                          <div class="dropdown-menu">
                            <a class="dropdown-item" href="javascript:delitemcode(\''.$_POST['idevent'].'\',\''.$row['ID'].'\');">
                              <i class="fa fa-reply fa-fw"></i>Xóa</a>						  
                          </div>
                        </div>
                      </div>						 
                       </td>						 
                        </tr>';
	}
}
}
