<?php
ob_start();
session_start();
require("includes/config.php");
if (!isset($_SESSION["username_$dbname"])) {
    header("Location: index.php");
} else {
    if ((time() - $_SESSION['last_login_timestamp']) > 600) { // 900 = 15 * 60  
        header("location:logout.php");
    } else {
        $_SESSION['last_login_timestamp'] = time();
    }
}
?>