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

	mysqli_query($conn,"UPDATE config_setting Set enable_autocharge = ".$_REQUEST['enableAutoCharge']." WHERE ID = 1");
	mysqli_query($conn, "UPDATE config_card Set khuyenmai = '".$_REQUEST['sett__nap_km']."', batdau = ".strtotime(str_replace('/','-',$_REQUEST['sett__nap_start'])).",ketthuc = '".strtotime(str_replace('/','-',$_REQUEST['sett__nap_end']))."' WHERE ID = '1'") or die('Có lỗi hãy thử lại');
	die('Chỉnh sữa thành công.');

}
?>