Source of: /ADI/auth-db-sessions/index.php
<?php
require_once "HTML/Template/IT.php";
$template = new HTML_Template_IT('.');
$template->loadTemplatefile('index_template.html', true, true);
$template->setCurrentBlock("HTML");
session_start();
if(isset($_SESSION['uid'])) {
$html = "<p>Welcome " . $_SESSION['username'] . "! You have entered a members-only area
of the site.</p>
<p>Here is a record of your personal data:</p>
<ul>
<li>email: ". $_SESSION['email'] . "</li>
<li>notes: ". $_SESSION['notes'] ."</li>
</ul>
<p><a href=\"logout.php\">Logout</a></p>";
}
else {
$html="<p>You must log in to access this area of the site.</p>
<p>If you are
not a registered user, <a href=\"signup.php\">click here</a>
to sign up for instant access, or <a href=\"login.html\">click here</a> to log in!</p>";
}
$template->setVariable('HTML', $html);
$template->parseCurrentBlock();
$template->show();
?>