Source of: /ADI/auth-db-sessions/index_smarty.php

<?php

// put full path to Smarty.class.php
require_once('/usr/share/php/smarty/libs/Smarty.class.php');
$smarty = new Smarty();

$smarty->template_dir = 'templates';
$smarty->compile_dir = 'templates_c';


session_start();
if(isset(
$_SESSION['userid'])) {

  
$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>user ID: "
. $_SESSION['userid'] . "</li>   
   <li>email: "
. $_SESSION['email'] . "</li>
   <li>notes: "
. $_SESSION['notes'] ."</li>
   </ul>
   <p><a href=\"logout_smarty.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_smarty.php\">click here</a>
   to sign up for instant access, or <a href=\"login_smarty.php\">click here</a> to log in!</p>
   <br><br>
   "
;

}

$smarty->assign('HTML', $html);



// Actualiza o template
$smarty->display('index_template.tpl');

?>