 <?php
	
	$del_id = $_GET['id'];
	$numtype = $_GET['num'];

	include("../config/mysql_connect.php");
	//include("check_admin.php");

	if($numtype == 'A'){

		$sql_del = "delete from tb_locknum where loc_type = 'A';";
		$objQuery = mysqli_query($link,$sql_del);

		if($objQuery){
		echo "<META HTTP-EQUIV=\"Refresh\" CONTENT=\"0;URL=numlock.php\">";
		}
		else{
		echo "<div class='alert alert-danger'>
		<button type='button' class='close' data-dismiss='alert'>&times;</button>
		<strong>Alerts!</strong> ล้มเหลว </div>";
		}

	}
	elseif($numtype == 'B'){

		$sql_del = "delete from tb_locknum where loc_type = 'B';";
		$objQuery = mysqli_query($link,$sql_del);

		if($objQuery){
		echo "<META HTTP-EQUIV=\"Refresh\" CONTENT=\"0;URL=numlock.php\">";
		}
		else{
		echo "<div class='alert alert-danger'>
		<button type='button' class='close' data-dismiss='alert'>&times;</button>
		<strong>Alerts!</strong> ล้มเหลว </div>";
		}
		
	}
	elseif($numtype == 'C'){

		$sql_del = "delete from tb_locknum where loc_type = 'C';";
		$objQuery = mysqli_query($link,$sql_del);

		if($objQuery){
		echo "<META HTTP-EQUIV=\"Refresh\" CONTENT=\"0;URL=numlock.php\">";
		}
		else{
		echo "<div class='alert alert-danger'>
		<button type='button' class='close' data-dismiss='alert'>&times;</button>
		<strong>Alerts!</strong> ล้มเหลว </div>";
		}

	}
	elseif($numtype == 'D'){

		$sql_del = "delete from tb_locknum where loc_type = 'D';";
		$objQuery = mysqli_query($link,$sql_del);

		if($objQuery){
		echo "<META HTTP-EQUIV=\"Refresh\" CONTENT=\"0;URL=numlock.php\">";
		}
		else{
		echo "<div class='alert alert-danger'>
		<button type='button' class='close' data-dismiss='alert'>&times;</button>
		<strong>Alerts!</strong> ล้มเหลว </div>";
		}
		
	}
	elseif($numtype == 'E'){

		$sql_del = "delete from tb_locknum where loc_type = 'E';";
		$objQuery = mysqli_query($link,$sql_del);

		if($objQuery){
		echo "<META HTTP-EQUIV=\"Refresh\" CONTENT=\"0;URL=numlock.php\">";
		}
		else{
		echo "<div class='alert alert-danger'>
		<button type='button' class='close' data-dismiss='alert'>&times;</button>
		<strong>Alerts!</strong> ล้มเหลว </div>";
		}

	}
	elseif($numtype == 'F'){

		$sql_del = "delete from tb_locknum where loc_type = 'F';";
		$objQuery = mysqli_query($link,$sql_del);

		if($objQuery){
		echo "<META HTTP-EQUIV=\"Refresh\" CONTENT=\"0;URL=numlock.php\">";
		}
		else{
		echo "<div class='alert alert-danger'>
		<button type='button' class='close' data-dismiss='alert'>&times;</button>
		<strong>Alerts!</strong> ล้มเหลว </div>";
		}
		
	}

	elseif($del_id){

		$sql_del = "delete from tb_locknum where loc_id = '$del_id';";
		$objQuery = mysqli_query($link,$sql_del);

		if($objQuery){
			echo "<META HTTP-EQUIV=\"Refresh\" CONTENT=\"0;URL=numlock.php\">";
		}
		else{
			echo "<div class='alert alert-danger'>
			<button type='button' class='close' data-dismiss='alert'>&times;</button>
			<strong>Alerts!</strong> ล้มเหลว </div>";
		}

	}

	else{
		echo "<META HTTP-EQUIV=\"Refresh\" CONTENT=\"0;URL=numlock.php\">";
	}

?>