<?php include("../templates/header.php"); ?>
<?php include("check_admin.php"); ?>

<div class="panel panel-danger">
  <div class="panel-heading">
    <h3 class="panel-title">ยืนยันการลบ Account ใช่หรือไม่ ?</h3>
  </div>
  <div class="panel-body">

  <?php
  include("../config/mysql_connect.php");

  $del_id = $_REQUEST['id'];

  if(isset($_REQUEST['delete'])){

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

	if($objQuery){
	echo "<meta http-equiv=refresh content=0;url=member.php>";
	}
	else{
		echo "<div class='alert alert-danger'>
		<button type='button' class='close' data-dismiss='alert'>&times;</button>
		<strong>Alerts!</strong> ล้มเหลว </div>";
	}


  }else{

  $strSQL = "SELECT * FROM tb_account WHERE acc_id = '$del_id'";
  $objQuery = mysqli_query($link,$strSQL);
  $Result = mysqli_fetch_array($objQuery);

  $acc_id = $Result['acc_id'];
  $acc_user = $Result['acc_user'];
  $acc_status = $Result['acc_status'];
  $acc_fname = $Result['acc_fname'];
  $acc_lname = $Result['acc_lname'];


  echo "
  <blockquote>
  <p><b>ID $acc_status</b>: $acc_user <b>ชื่อ-สกุล</b>: $acc_fname  $acc_lname</p>
  <small>คุณกำลังพยายามจะลบ Account ดังกล่าวออกจากระบบ !</small></blockquote>
  <a href='member.php' class='btn btn-primary'>ยกเลิก</a>
  <a href='delete_acc.php?id=$acc_id&delete=on' class='btn btn-danger'>ลบเลย</a>";

  }

  ?>

  </div>
</div>

<?php include("../templates/footer.php"); ?>