viewcount.php

<?php
/* Simple page to demonstrate use of a session.  It simply counts
   the number of times the visitor has seen the page during this session.
   Adapted from an example at php.net.
 */

session_start();

if (empty($_SESSION['count'])) {
   $_SESSION['count'] = 1;
} else {
   $_SESSION['count']++;
}
?>

<!DOCTYPE html>
<html>
  <head>
    <title>Visit Counter</title>
    <meta charset="utf-8" />
  </head>
  <body>
    <p>
      Hello visitor, you have seen this page <?php echo $_SESSION['count']; ?> times in this session.
    </p>

    <p>
      To continue, <a href="nextpage.php">click here</a>.
    </p>
  </body>
</html>