actProduct.php :
<?php
if(!isset($_SESSION)) {
session_start();
};
include 'connect.php';
include 'config.php';
if (isset($_POST['id'])) {
if(is_numeric(openssl_decrypt( $_POST['id'], COD, KEY))){
$ID=openssl_decrypt($_POST['id'],COD,KEY);
foreach($_SESSION['cart'] as $indice=>$producto){
if($producto['ID']==$ID){
if($_POST['cantidadupd']<1){
$_SESSION['cart'][$indice]['CANTIDAD']= 1;
}else{
$_SESSION['cart'][$indice]['CANTIDAD'] = $_POST['cantidadupd'];
}
}
}
}
header('location: ../cart.php');
}else{
echo '<script>alert("Ha ocurrido un error"); window.location = "../cart.php";</script>';
exit;
}