
<?php
session_start();

include_once 'db.php';
include_once "ewcfg12.php";
include_once ((EW_USE_ADODB) ? "adodb5/adodb.inc.php" : "ewmysql12.php");
include_once "phpfn12.php";
include_once "class.user.php";

$user     = new USER($DB_con);

if(!$user->is_loggedin())
{
 $user->redirect('login.php');
}


$user_id = trim(ew_RemoveXSS(ew_StripSlashes($_SESSION['user_session'])));  // logged in user id
$userid  = trim(ew_RemoveXSS(ew_StripSlashes($_POST['userid'         ])));  // user id to be deleted

// DELETE FROM WEBUSER TABLE
$stmt = $DB_con->prepare("DELETE FROM WEBUSER
                           WHERE USERID=:uid
                         ");
$stmt->bindparam(":uid", $userid);
$stmt->execute();

// DELETE FROM WEBUSERPROFILE TABLE
$stmt = $DB_con->prepare("DELETE FROM WEBUSERPROFILE
                           WHERE USERID=:uid
                         ");
$stmt->bindparam(":uid", $userid);
$stmt->execute();

$user->log($user_id, 13, "User $userid deleted");

?>