Source code of session2.php
<?php
$username = $_POST['username'];
$passwd = $_POST['passwd'];
// Normally I would do some sort of validation at this point
// For example, I could check to see if the username/passwd
// combination is a valid user in my database
session_start();
$_SESSION['username'] = $username;
print <<<END_PAGE
<html>
<head><title>Session Demo</title></head>
<body>
Thank you for logging in, $username. <a href='session3.php'>Click here</a>
to continue using our site.
</body>
</html>
END_PAGE;
?>