I have an ecommerce site that is dropping the Session var that stores the cart info and I cannot for the life of me diagnose why. I am creating a unique session id when the user comes to the shopping cart page for the first time, and feeding it to a class which store it along with the items in a databse. Here is how I create the cart id:
session_start();
if(!isset($_SESSION['cart_id'])) {
$cart_id = md5(uniqid(rand()));
$_SESSION["cart_id"] = $cart_id;
} else {
$cart_id = $_SESSION["cart_id"];
}
require_once("../classes/shoppingcart.php");
$cart = new cart($cart_id);
I thought the session was just timing out so I used a .htacces file to force the session to last longer. It still drops teh session variable and the user loses all of their selections.
I also tried using cookies instead, I am getting the same problem.
PLEASE HELP!