Codice PHP:
<?
require 'config/config.php'// VARIABILI ACCESSO DB

// SALTO PAGINA
$jump_login 'login.php';
$jump_logout 'index.php';

session_start();

// LOGOUT
if($logout) {
    
session_destroy();
    echo 
"<script language='JavaScript'>window.location='$jump_logout'</script>";
    exit();
}
// GIA LOGGATO
elseif(isset($HTTP_SESSION_VARS['access'])) {
    
//$userid = $HTTP_SESSION_VARS['sblocco_userid']; // SBLOCCO UTENTE
}
// LOGIN
elseif(isset($HTTP_POST_VARS['username']) && isset($HTTP_POST_VARS['password'])) {
        
    
// CERCO UTENTE
    
$username $_POST['username'];
    
$password $_POST['password'];
    
$link mysql_connect($dbhost$dbuser$dbpass);
    
$query "SELECT username, password FROM $dbcfg WHERE username='$username' AND password='$password'";
    
$result mysql_db_query($dbname$query$link);
    
$found = @mysql_num_rows($result);
    
    if(
$found) { // SE UTENTE TROVATO
        
$HTTP_SESSION_VARS['access'] = true;
        
mysql_close($link);        
    } else {
        
$error "<font class='text'>[b]Errore: Nome Utente o Password non validi[/b]</font>

"
;
        
mysql_close($link);
        include(
$jump_login);
        exit();
    }

// NON LOGGATO
else {
    include(
$jump_login);
    exit();
}
?>