You need to save an ID, something you can use to identify users by, to a
cookie. Something like...
$setcookie( 'userId', $userID );
Then when they come back check for the value in the cookie structure.
if (isset( $_COOKIE['userId'] ))
{
$userId = $_COOKIE['userId'];
}
But, you have to be careful with the security risk this creates. At least
make sure that $userId is not a sequential number so it can't be faked to
gain unathorized access to someone else's records.
Balazs
<news:1110991855.2...@z14g2000cwz.googlegroups.com> (
http://groups.google.com/group/comp.lang.php/msg/310fad0eef59415a )
--
<?php echo 'Just another PHP saint'; ?>
Email: rrjanbiah-at-Y!com Blog: http://rajeshanbiah.blogspot.com/
You use the session to track a user's actions through your site. By default
a session lasts as long as the browser is open, but this can be changed.
http://us2.php.net/manual/en/ref.session.php
You use the cookie to identify a user. But when they return the next time
they will probably start a new session.
Here's how to set the expiration of your cookie:
http://us2.php.net/manual/en/function.setcookie.php
Balazs