1. Yes it is possible.
First of all, regarding the use of session_register().

Originally Posted by
PHP Manual
Warning
This function has been DEPRECATED as of PHP 5.3.0 and REMOVED as of PHP 6.0.0. Relying on this feature is highly discouraged.
PHP Code:
session_start();
$cart = ("TS0001 => 3, TS0002 => 2");
$_SESSION['cart'] = serialize($cart);
The array is now stored in $_SESSION['cart']. To retrieve it:
PHP Code:
$cart_contents = unserialize($_SESSION['cart']);
2. You can:
a) If you have access to your php.ini file, you can adjust the session.gc_maxlifetime directive.
b) Use cookies instead of sessions
c) Use a temporary table to store the cart instead of sessions. You'd still need a cookie to identify the record if the user comes back.
Bookmarks