<?php
session_start();
include_once 'cauhinh.php';
$ketnoi = @mysqli_connect($db_host,$db_user,$db_pass,$db_name ) or die("$_domain: thong tin ket noi du lieu chua chinh xac");
@mysqli_set_charset($ketnoi,"utf8");

function get_string_tinhtrangthe($tinhtrangthe) {
switch ($tinhtrangthe) {
case 0:
$str = '<span class="btn btn-warning form-fontrol">Chờ xử lý</span>';
break;
case 1:
$str = '<span class="btn btn-success form-fontrol">Nạp Thành Công</span>';
break;
case 2:
$str = '<div class="btn" style="background-color:red;color:#fff; ">Thẻ Sai</div>';
break;
default:
$str = '<span class="btn btn-danger form-fontrol">Lỗi Chưa Xác Định</span>';
break;
}
return $str;
}

/////////////////////////
//   //
// Xoá đi hoặc sửa nếu bị bug thì mình k chịu trách nhiệm //
///////////////////////// GET
 foreach($_GET as $var => $value) {
 
    $_GET["$var"]= htmlspecialchars(mysqli_real_escape_string($ketnoi, $value));

}

// POST
foreach($_POST as $var => $value) {

    $_POST["$var"] = htmlspecialchars(mysqli_real_escape_string($ketnoi, $value));
  
}
 

// $_SESSION
foreach($_SESSION as $var => $value) {
   
    $_SESSION["$var"]= htmlspecialchars(mysqli_real_escape_string($ketnoi, $value));
}


// $_COOKIE
foreach($_COOKIE as $var => $value) {

    $_COOKIE["$var"]= htmlspecialchars(mysqli_real_escape_string($ketnoi, $value));
}

$tacgia = $_SERVER["HTTP_HOST"];
date_default_timezone_set('Asia/Ho_Chi_Minh');



/*
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.4/jquery.min.js"> </script>
   
	<script src="https://cdnjs.cloudflare.com/ajax/libs/limonte-sweetalert2/6.11.5/sweetalert2.all.js"></script>
 	<script>
 	$(document).ready(function(){
		$('#napthe').click(function() {
		$('#napthe').html('Đang thực hiện...');
		$('#napthe').prop('disabled', true);
		var formData = {
	
		'serial'              : $('input[name=serial]').val(),
		'code'              : $('input[name=pin]').val(),
		'telco'              : $('select[name=type]').val(),
		'amount'              : $('select[name=amount]').val()
		};
		$.post("/napthe", formData,
			function (data) {
			    if(data.status == '1'){
				swal('Thông báo', data.msg, 'error');
				$('#napthe').html('Nạp ngay');
			$('#napthe').prop('disabled', false);
			    }else{
			     //window.location="/";   
			     swal('Thông báo', data.msg, 'success');
			     	$('#napthe').html('Nạp ngay');
			$('#napthe').prop('disabled', false);
			    }
		}, "json");
	});
});

</script>


*/



