Example #1
0
<?php

// our Smarty instance, used for rendering the webpages
$g_smarty = new Smarty();
$config_file_exists = false;
if (is_file(dirname(__FILE__) . "/config.php")) {
    $config_file_exists = true;
    include_once dirname(__FILE__) . "/config.php";
}
if ($config_file_exists) {
    // if the config file exists, we can assume the user isn't installed
    $g_link = ft_db_connect();
    // load the appropriate language file
    $g_language = ft_get_ui_language();
    require_once dirname(__FILE__) . "/lang/{$g_language}.php";
    if (isset($_GET["logout"])) {
        ft_logout_user();
    }
}
Example #2
0
/**
 * This is called on all page loads. It checks to ensure that the person's sessions haven't timed out. If not,
 * it updates the last_activity_unixtime in the user's sessions - otherwise they're logged out.
 */
function ft_check_sessions_timeout($auto_logout = true)
{
    $now = date("U");
    $sessions_valid = true;
    // check to see if the session has timed-out
    if (isset($_SESSION["ft"]["account"]["last_activity_unixtime"]) && isset($_SESSION["ft"]["account"]["sessions_timeout"])) {
        $sessions_timeout_mins = $_SESSION["ft"]["account"]["sessions_timeout"];
        $timeout_secs = $sessions_timeout_mins * 60;
        if ($_SESSION["ft"]["account"]["last_activity_unixtime"] + $timeout_secs < $now) {
            if ($auto_logout) {
                ft_logout_user("notify_sessions_timeout");
            } else {
                $sessions_valid = false;
            }
        }
    }
    // log this unixtime for checking the sessions timeout
    $_SESSION["ft"]["account"]["last_activity_unixtime"] = $now;
    return $sessions_valid;
}