<?php
session_start();
header('Access-Control-Allow-Origin: *');

header('Access-Control-Allow-Methods: GET, POST');

header("Access-Control-Allow-Headers: X-Requested-With");
if(isset($_POST['user_id']))
{

include 'config.php';
$user_id=$_POST['user_id'];

$user_id=stripslashes($user_id);
$user_id=mysqli_escape_string($con, $user_id);

$auth=$_POST['auth'];
$auth=stripslashes($auth);
$auth=mysqli_escape_string($con, $auth);



//$email=mysqli_escape_string($con, $email);
$sql="SELECT * FROM users WHERE user_id ='$user_id' AND auth = '$auth'";
$result=$con->query($sql) or die ("error: Server error ".mysqli_error($con));

if($result)
{
  $count=mysqli_num_rows($result);
  if($count==1)
  
{

$sqlx="UPDATE users set status = 'Deleted' WHERE user_id = '$user_id' AND auth = '$auth'";
$resultx=$con->query($sqlx) or die ("error2: Server error ".mysqli_error($con));

if($resultx)
{
$suc = "Success";
$status = true;
}
}

  else
  
  {
         $suc = "Failed"; 
         $status = false;

    //$log_error="Email address not found!";
    }
   }
  

$con->close();

$output = array('status'=>$status, 'success'=>$suc);
echo json_encode($output); //output JSON data

}

?>
