maybe something like this would work:
PHP Code:
<?
// check if the current page is in the session array
if ( !in_array($_SERVER['SCRIPT_NAME'], $_SESSION['visited_pages']) ) {
// if not, add it
$_SESSION['visited_pages'][] = $_SERVER['SCRIPT_NAME'];
}
?>
so then to check if a user has visited a certain page, you could do this:
PHP Code:
<?
if ( in_array("somepage.php", $_SESSION['visited_pages']) ) {
// user has visited somepage.php
} else {
// user has not visited somepage.php
?>
keep in mind that $_SERVER['SCRIPT_NAME'] does not include the query variables. if you want to count the same php script with different query variables as different pages, then you should use $_SERVER['REQUEST_URI'] instead.
for example, with SCRIPT_NAME, these pages would all be the same:
/mypage.php?a=1
/mypage.php?a=52
REQUEST_URI includes the query variable in the value.