Clear destroy session id on last checkout page

hi all

this thing is for guest checkout who is not logged in

i am using and storing session_id() in all my database tables like cart table, user table, invoice table etc.

$sid = session_id();

i fetch and display information according to this session_id() when user adds products to cart and purchase anything on website

now i want that

when user has completed the purchase steps, means when he reaches last page

the session_id() should get destroy, his cart should get automatically empty etc

so how do i destroy current session after all information get stored in database.

on the last page in the footer i tried inserting this code

$_SESSION = array(); 
session_unset();
session_destroy();

but it didnt destroyed the current session_id.

the cart didnt cleared out.

then i tried inserting this code in the conf file
which is included on top of everypage and has session_start()

session_start();
if($_SERVER['SCRIPT_NAME'] == '/lastcheckoutpage.php')
{
$_SESSION = array(); 
session_unset();
session_destroy();
}

but it didnt destroyed the current session_id.

the cart didnt cleared out.

when i go back on cart page , then products are still there and

when i echo $sid then it echoes same current session_id value

vineet

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