You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
33 lines
808 B
33 lines
808 B
<?php
|
|
session_start();
|
|
session_id(trim($_GET['sid']));
|
|
include_once './config.php';
|
|
include_once './database.php';
|
|
|
|
header("Access-Control-Allow-Origin: *");
|
|
header("Content-Type: application/json; charset=UTF-8");
|
|
header("Access-Control-Allow-Methods: POST");
|
|
header("Access-Control-Max-Age: 3600");
|
|
header("Access-Control-Allow-Headers: Content-Type, Access-Control-Allow-Headers, Authorization, X-Requested-With");
|
|
|
|
$databaseService = new DatabaseService();
|
|
$conn = $databaseService->getConnection();
|
|
|
|
$pid = trim($_POST['pid']);
|
|
|
|
foreach($_SESSION['CART'] as $k => $item) {
|
|
if($item['pid'] == $pid) {
|
|
unset($_SESSION['CART'][$k]);
|
|
}
|
|
}
|
|
|
|
//print_r($_SESSION['CART']);
|
|
http_response_code(200);
|
|
echo json_encode(
|
|
array(
|
|
"status" => 200,
|
|
"cart" => array_values($_SESSION['CART'])
|
|
));
|
|
|
|
?>
|
|
|