<?php
    session_start();
?>

<!DOCTYPE html>
<html  xmlns="http://www.w3.org/1999/xhtml">

<!--
    our first session example

    by: Sharon Tuttle
    last modified: 2016-03-21
-->

<head>  
    <title> playing with PHP sessions </title>
    <meta charset="utf-8" />

    <link href="http://users.humboldt.edu/smtuttle/styles/normalize.css" 
          type="text/css" rel="stylesheet" />
</head> 

<body> 
    <h1> playing with PHP sessions </h1>

    <?php
        if (! array_key_exists("count", $_SESSION))
        {
            $_SESSION['count'] = 1;
        }
        else
        {
            $_SESSION['count']++;
        }
    ?>

    <p> 
        the count session attribute
        is: <?= $_SESSION['count'] ?> 
    </p>

    <?php
        // I decide that when/if count exceeds 7,
        //     I will destroy the current session

        if ($_SESSION['count'] > 7)
        {
            session_destroy();
        }

        require_once("328footer-better.html");
    ?>

</body> 
</html>