<?php

require_once 'includes/travel-setup.inc.php';
include 'includes/functions.php';
if (isset($_GET['delete-all-image'])) {
    unset($_SESSION['favoriteImageList']);
} elseif (isset($_GET['delete-all-post'])) {
    unset($_SESSION['favoritePostList']);
} elseif (isset($_GET['delete-image'])) {
    removeSingleItem('favoriteImageList', $_GET['delete-image'], 'imageID');
} elseif (isset($_GET['delete-post'])) {
    removeSingleItem('favoritePostList', $_GET['delete-post'], 'postID');
}
header('Location: browse-favorites.php');
                $shipping = 5;
            } elseif ($frameC <= 10) {
                $shipping = 15;
            } elseif ($frameC > 10) {
                $shipping = 30;
            } else {
            }
        }
    }
    //adds the new shipping cost to the JSON return object.
    $shipping = number_format((double) $shipping, 2, '.', '');
    $serArr["shipCost"] = $shipping;
}
if (isset($_POST["remove"]) && $_POST["remove"] == "yes") {
    $remove = $_POST["remove"];
    removeSingleItem("Cart", $_POST["serial"], "serial");
    $serArr[$_POST["serial"]] = $_POST["serial"];
}
//calculates the new total and adds it to the JSON return object.
$total = $sub + $shipping;
$total = number_format((double) $total, 2, '.', '');
$serArr["total"] = $total;
//adds the new subtotal to the JSON return object.
$sub = number_format($sub, 2, '.', '');
$serArr["sub"] = $sub;
//returns the JSON object back to the user for an asynchronous  update of the page.
echo json_encode($serArr);
//required for the counting the frames when calculating the shipping cost.
function frameCount()
{
    $frameCount = 0;