<?php include('../includes/connection.php');
@session_start();

if(!isset($_SESSION['admin_login'])) {
  header("Location: login.php");
  }


if($_GET['h']=='updatestatus'){

    $status = str_replace("'", "\'", $_POST['status']);
    $status_remark = str_replace("'", "\'", $_POST['status_remark']);
    $destination = str_replace("'", "\'", $_POST['destination']);
    $shippingdate = str_replace("'", "\'", $_POST['shippingdate']);

    // mysqli_query($DB_CONN,"UPDATE `shipping` SET `status`='{$status}',`status_remark`='{$status_remark}',`destination`='{$destination}' WHERE id='{$_POST['hide_id']}'");
    
    mysqli_query($DB_CONN,"INSERT INTO `statuses`(`status`,`status_remark`, `date`,`destination`,`shipping_id`) VALUES ('{$status}','{$status_remark}','{$shippingdate}','{$destination}','{$_POST['hide_id']}')");

}


if($_GET['h']=='delete_shipping'){

    mysqli_query($DB_CONN,"DELETE from shipping WHERE id='{$_POST['hide_id']}'");

}

if($_GET['h']=='delete_vault'){

    mysqli_query($DB_CONN,"DELETE from vault WHERE id='{$_POST['hide_id']}'");
    
}


?>