how to show Last Five Pages Visited Cookie with php jquery.
+2
A:
Instead of using PHP and jQuery, this can be accomplished solely with PHP:
session_start();
if(empty($_SESSION['history']))
$_SESSION['history'] = array($_SERVER['PHP_SELF']);
else {
$_SESSION['history'][] = $_SERVER['PHP_SELF'];
if(count($_SESSION['history']) > 5)
array_shift($_SESSION['history']);
}
$_SESSION['history']
will be an array of URLs that the user has visited limited to 5.
mattbasta
2009-11-22 21:34:43