 <?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($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\">";
	}

?>