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.
29 lines
750 B
29 lines
750 B
<?php
|
|
session_start();
|
|
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();
|
|
|
|
$sid = trim($_POST['sid']);
|
|
$pid = trim($_POST['pid']);
|
|
$qty = trim($_POST['qty']);
|
|
|
|
$_SESSION['CART'][] = array("pid" => intval($pid), "qty" => intval($qty));
|
|
|
|
http_response_code(200);
|
|
echo json_encode(
|
|
array(
|
|
"status" => 200,
|
|
"cart" => $_SESSION['CART']
|
|
));
|
|
|
|
?>
|
|
|