<?php
session_start();
include_once 'cauhinh.php';

date_default_timezone_set('Asia/Ho_Chi_Minh');
$_login = isset($_login) ? $_login : null;
include_once 'config.php';
$_user = isset($_SESSION['user']) ? $_SESSION['user'] : null;
if($_user != null)
{
	$_login = "on";
	$user_arr = _fetch("SELECT * FROM player Where username='$_user'");
	if(count($user_arr) <= 0){header("location:/?out");}
	$_username = htmlspecialchars($user_arr['username']);
	$_password = htmlspecialchars($user_arr['password']);
	$_phone = htmlspecialchars($user_arr['phone']);
	$_coin = $user_arr['coin'];
	$_luong = $user_arr['luong'];
	$_ngaythamgia = $user_arr['ngaythamgia'];
	$_nhomkhachhang = $user_arr['nhomkhachhang'];
	$_status = htmlspecialchars($user_arr['status']);
	switch ($_status) {
		case 'active':
			$_status_name = '<span style="color:green;font-weight: bold;">Đã kích hoạt';
			break;
		case 'wait':
			$_status_name = '<span style="color:#007BFF;font-weight: bold;"><a href="/active">Kích hoạt ngay</a>';
			break;
		case 'block':
			$_status_name = '<span style="color:red;font-weight: bold;">Đang bị khóa';
			break;
	}
}
else
{
	$_login = null;
}
if (isset($_GET['out']))
{
	session_destroy();
	header("location:/");
}
?>