Hi All,
So, I've been playin' around with sessions in PHP today, and after procrastinating over whether I should use sessions or not since I started PHP about 6 months ago (it looked scary), I've found it to be quite simple. But I am using time() as a session id, I'll explain why...
I found a page on session reference in php.net website, and one of the code samples uses this to manage sessions:
session_start();
if( !isset($_SESSION['last_access']) || (time() - $_SESSION['last_access']) > 60)
$_SESSION['last_access'] = time();
However, this expires very quickly. Ofcourse, I COULD change 60 to a very high number, but this is for a website where customers will be spending on average, 3 - 4 hours just adding products to the shopping cart, so I can't have sessions expire unless they close the page.
How can I transfer the same session id over to all pages on our site regardless of time(). I don't really want to be using time to manage session id's.
I DID use the constant SID
in a url like this:
<?php echo '<a href="theotherpage.php?sessid='.SID.'">go to another page</a>'; ?>
however, using the constant, as advised by the PHP website, does not work.
Can someone please help me maintain the same session id, regardless of time, across the whole site?
Your help is much appreciated, and thanks! :)