Update session

Hi chaps, ive inherited a site and need to make some changes. The setup at the moment is at the start of the script:

if($_GET['del']==1 && isset($_GET['rid']) && $_GET['rid']!='' && $_GET['rid']!=0)

{ 

	$r=$_GET['rid'];

	$pos=$_GET['pos'];

	$_SESSION['qty']=$_SESSION['qty']-$_SESSION['cart'][$pos]['qty'];

    unset($_SESSION['cart'][$pos]);

	
$_SESSION['cart'] = array_values($_SESSION['cart']);
	

	
	
}

and theres a delete URL that deletes the session ‘position’, formed as:

cart.php?rid=<?=$p['prodid']?>&del=1&pos=<?=$arr['position']?>

…now everything works fine, however i have two questions.

Firstly, what i dont understand is, if i change the original url (cart.php? (_self)) to a blank page without code (for example test.php), the script still fires and the session row is deleted. I ‘presumed’, that as the link is _self, itll run through the script again, hence catching the ‘del==1’ script…why am i so wrong?

Secondly, as ive made the site using seo friendly urls, itd be nice to continue in the same vain, however how would i construct the url not only to fire the script but also remain (upon refresh) on website.com/lang/cart. ?

After spending the last 3 days goingg through the code, i thought id got it sorted, by hey…Thanks in advance

Sorry, ive got it sorted…there must have been an issue with my cache that was throwing incorrect session values (have many browsers open on the same site…)

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.