function cometchatSessionGarbageCollector($lifetime)
{
    global $dbh;
    cometchatDBConnect();
    $sql = "DELETE FROM cometchat_session WHERE session_lastaccesstime < DATE_SUB(NOW(), INTERVAL " . mysqli_real_escape_string($GLOBALS['dbh'], $lifetime) . " SECOND)";
    $query = mysqli_query($GLOBALS['dbh'], $sql);
}
function getColorVars()
{
    global $client;
    include_once dirname(__FILE__) . DIRECTORY_SEPARATOR . "cometchat_cache.php";
    global $settingscache;
    global $colors;
    phpFastCache::setup("path", dirname(__FILE__) . DIRECTORY_SEPARATOR . 'writable' . DIRECTORY_SEPARATOR . 'cache');
    phpFastCache::setup("storage", 'files');
    $settingscache = phpFastCache();
    if ($conf = getCachedSettings($client . "cometchat_color", 3600)) {
        $colors = unserialize($conf);
    } else {
        cometchatDBConnect();
        $colors = array();
        $sql = "select `color_key`,`color_value`,`color` from `cometchat_colors`";
        $query = mysqli_query($GLOBALS['dbh'], $sql);
        while ($color = mysqli_fetch_assoc($query)) {
            if (empty($colors[$color['color']])) {
                $colors[$color['color']] = array();
            }
            $colors[$color['color']][$color['color_key']] = $color['color_value'];
        }
        setCachedSettings($client . "cometchat_color", serialize($colors), 3600);
    }
}
}
if (get_magic_quotes_runtime()) {
    set_magic_quotes_runtime(false);
}
include_once dirname(__FILE__) . DIRECTORY_SEPARATOR . "shared.php";
function stripSlashesDeep($value)
{
    $value = is_array($value) ? array_map('stripSlashesDeep', $value) : stripslashes($value);
    return $value;
}
if (get_magic_quotes_gpc() || defined('FORCE_MAGIC_QUOTES') && FORCE_MAGIC_QUOTES == 1) {
    $_GET = stripSlashesDeep($_GET);
    $_POST = stripSlashesDeep($_POST);
    $_COOKIE = stripSlashesDeep($_COOKIE);
}
cometchatDBConnect();
cometchatMemcacheConnect();
$usertable = TABLE_PREFIX . DB_USERTABLE;
$usertable_username = DB_USERTABLE_NAME;
$usertable_userid = DB_USERTABLE_USERID;
$body = '';
if (!empty($_POST['username'])) {
    $_SESSION['cometchat']['cometchat_admin_user'] = $_POST['username'];
}
if (!empty($_POST['password'])) {
    $_SESSION['cometchat']['cometchat_admin_pass'] = $_POST['password'];
}
authenticate();
$module = "dashboard";
$action = "index";
error_reporting(E_ALL);