<?php require_once('unibenkgh.php'); ?>
<?php
if (!function_exists("GetSQLValueString")) {
function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "") 
{
  if (PHP_VERSION < 6) {
    $theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue;
  }

  $theValue = function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($theValue);

  switch ($theType) {
    case "text":
      $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
      break;    
    case "long":
    case "int":
      $theValue = ($theValue != "") ? intval($theValue) : "NULL";
      break;
    case "double":
      $theValue = ($theValue != "") ? doubleval($theValue) : "NULL";
      break;
    case "date":
      $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
      break;
    case "defined":
      $theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue;
      break;
  }
  return $theValue;
}
}

if ((isset($_POST['customernum'])) && ($_POST['customernum'] != "")) {
  $deleteSQL = sprintf("DELETE FROM ibank WHERE customernum=%s",
                       GetSQLValueString($_POST['customernum'], "text"));

  mysql_select_db($database_unibenkgh, $unibenkgh);
  $Result1 = mysql_query($deleteSQL, $unibenkgh) or die(mysql_error());
}

if ((isset($_POST['customernum'])) && ($_POST['customernum'] != "")) {
  $deleteSQL = sprintf("DELETE FROM bill WHERE customernum=%s",
                       GetSQLValueString($_POST['customernum'], "text"));

  mysql_select_db($database_unibenkgh, $unibenkgh);
  $Result1 = mysql_query($deleteSQL, $unibenkgh) or die(mysql_error());
}

if ((isset($_POST['customernum'])) && ($_POST['customernum'] != "")) {
  $deleteSQL = sprintf("DELETE FROM deposits WHERE customernum=%s",
                       GetSQLValueString($_POST['customernum'], "text"));

  mysql_select_db($database_unibenkgh, $unibenkgh);
  $Result1 = mysql_query($deleteSQL, $unibenkgh) or die(mysql_error());
}

if ((isset($_POST['customernum'])) && ($_POST['customernum'] != "")) {
  $deleteSQL = sprintf("DELETE FROM transfers WHERE customernum=%s",
                       GetSQLValueString($_POST['customernum'], "text"));

  mysql_select_db($database_unibenkgh, $unibenkgh);
  $Result1 = mysql_query($deleteSQL, $unibenkgh) or die(mysql_error());
}

if ((isset($_POST['customernum'])) && ($_POST['customernum'] != "")) {
  $deleteSQL = sprintf("DELETE FROM withdrawal WHERE customernum=%s",
                       GetSQLValueString($_POST['customernum'], "text"));

  mysql_select_db($database_unibenkgh, $unibenkgh);
  $Result1 = mysql_query($deleteSQL, $unibenkgh) or die(mysql_error());

  $deleteGoTo = "vd.php";
  if (isset($_SERVER['QUERY_STRING'])) {
    $deleteGoTo .= (strpos($deleteGoTo, '?')) ? "&" : "?";
    $deleteGoTo .= $_SERVER['QUERY_STRING'];
  }
  header(sprintf("Location: %s", $deleteGoTo));
}
?>
<a href="index.php">Home page</a>
