<?
session_set_cookie_params(60*60*24);
session_start();
?>
<html><body><center>
<?
if (!isset($_SESSION['user']) || empty($_SESSION['user']))
{
	echo "<p align='center'>You are not logged in.</p>";
	echo "<a href='session1_clean.php'>Log in</a><BR>";
}
else
{
	$username = $_SESSION['user'];
	echo "Your username is: $username<br>";

	if (!isset($_SESSION['counter']))
        	echo "No visits so far.<p>";
	else
	{
		$_SESSION['counter']++;
	        $count = $_SESSION['counter'];
       	 	echo "This computer visited the homepage: $count times.";
	}
	echo "<br><a href='session3_clean.php'>Log out</a>";
	/* If cookies are disabled, you need to replace the above line by the one below*/
	//echo "<br><a href='session3.php?", strip_tags(session_id()), "'>log out</a>";
}
?>
</center></body></html>
