Jump to content

Sessions problems (only with AOL)


emma57573

Recommended Posts

I am having issues with my session script BUT its only effecting AOL clients. Its fine for everyone else. Is it something to do with my script or is this an aol bug??

 

Does anyone know of a fix? I have a client that wants to purchase an item and cant!! help!

 

This is the cart session

<? function writeShoppingCart() {
$cart = $_SESSION['cart'];
if (!$cart) {
	return '0';
} else {
	// Parse the cart session variable
	$items = explode(',',$cart);
	$s = (count($items) > 1) ? 's':'';
	return '<a href="cart.php" class="smlorange">'.count($items).' </a>';
}
}




// Process actions
$cart = $_SESSION['cart'];
$action = $_GET['action'];
switch ($action) {
case 'add':
	if ($cart) {
		$cart .= ','.$_GET['user_id'];
	} else {
		$cart = $_GET['user_id'];
	}
	break;
case 'delete':
	if ($cart) {
		$items = explode(',',$cart);
		$newcart = '';
		foreach ($items as $item) {
			if ($_GET['user_id'] != $item) {
				if ($newcart != '') {
					$newcart .= ','.$item;
				} else {
					$newcart = $item;
				}
			}
		}
		$cart = $newcart;
	}
	break;
case 'update':
if ($cart) {
	$newcart = '';
	foreach ($_POST as $key=>$value) {
		if (stristr($key,'qty')) {
			$user_id = str_replace('qty','',$key);
			$items = ($newcart != '') ? explode(',',$newcart) : explode(',',$cart);
			$newcart = '';
			foreach ($items as $item) {
				if ($user_id != $item) {
					if ($newcart != '') {
						$newcart .= ','.$item;
					} else {
						$newcart = $item;
					}
				}
			}
			for ($i=1;$i<=$value;$i++) {
				if ($newcart != '') {
					$newcart .= ','.$user_id;
				} else {
					$newcart = $user_id;
				}
			}
		}
	}
}
$cart = $newcart;
break;
}
$_SESSION['cart'] = $cart;


?>

 

The aol users have issues registering also as they cant see the catcha which makes me think its an aol thing as thats a completley different script. But I still need to find a workaround for this

 

Thanks

 

 

Link to comment
https://forums.phpfreaks.com/topic/134974-sessions-problems-only-with-aol/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.