<?php include("session_controller.php"); ?>

<?php

if ((isset($_GET['account_no'])) && ($_GET['account_no'] != "")) {
  $deleteSQL = sprintf("DELETE FROM accounts WHERE account_no=%s",
                       GetSQLValueString($_GET['account_no'], "int"));

  mysqli_select_db($conn, $database_conn);
  $Result1 = mysqli_query($conn, $deleteSQL) or die(mysqli_error($conn));

  $deleteGoTo = $_SERVER['HTTP_REFERER'];
  if (isset($_SERVER['QUERY_STRING'])) {
    $deleteGoTo .= (strpos($deleteGoTo, '?')) ? "&" : "?";
    $deleteGoTo .= $_SERVER['QUERY_STRING'];
  }
  header(sprintf("Location: %s", $deleteGoTo));
}
?>