function start()
    {
        global $_CLASS, $_CORE_CONFIG, $SID, $mod;
        $session_id = get_variable($_CORE_CONFIG['server']['cookie_name'] . '_sid', 'COOKIE');
        $session_id_url = get_variable('sid', 'GET');
        if ($session_id_url && (!$session_id || $session_id !== $session_id_url)) {
            $session_id = $session_id_url;
        } elseif (!defined('NEED_SID')) {
            $this->need_sid = false;
        }
        if ($session_id) {
            $sql = 'SELECT u.*, s.*
				FROM ' . CORE_SESSIONS_TABLE . ' s, ' . CORE_USERS_TABLE . " u\n\t\t\t\tWHERE s.session_id = '" . $_CLASS['core_db']->escape($session_id) . "'\n\t\t\t\t\tAND u.user_id = s.session_user_id";
            $result = $_CLASS['core_db']->query($sql);
            $this->data = $_CLASS['core_db']->fetch_row_assoc($result);
            $_CLASS['core_db']->free_result($result);
            if (isset($this->data['user_id']) && ($this->data['user_id'] == ANONYMOUS || $this->data['user_status'] == STATUS_ACTIVE)) {
                $valid = true;
                if ($this->data['session_browser'] !== $this->browser) {
                    $valid = false;
                }
                if ($valid && $_CORE_CONFIG['server']['ip_check']) {
                    $check_ip = implode('.', explode('.', $this->data['session_ip'], $_CORE_CONFIG['server']['ip_check']));
                    if ($check_ip !== substr($this->ip, 0, strlen($check_ip))) {
                        $valid = false;
                    }
                }
                if ($valid) {
                    // Set session update a minute or so after last update or if page changes
                    if ($this->time - $this->data['session_time'] > 60 || $this->data['session_url'] !== $this->url) {
                        $this->save_session = true;
                    }
                    $this->data['session_data'] = $this->data['session_data'] ? unserialize($this->data['session_data']) : array();
                    $this->data['user_data'] = $this->data['user_data'] ? unserialize($this->data['user_data']) : array();
                    load_class(false, 'core_auth', 'auth_db');
                    $this->is_user = $this->data['user_type'] == USER_NORMAL;
                    $this->is_bot = $this->data['user_type'] == USER_BOT;
                    $this->is_admin = $this->data['session_admin'] == ADMIN_IS_ADMIN;
                    check_maintance_status();
                    if ($this->is_bot) {
                        $this->need_sid = false;
                    }
                    $this->autologin_code = $this->data['session_autologin'];
                    $this->load = check_load_status();
                    $this->sid_link = 'sid=' . $this->data['session_id'];
                    return true;
                }
            }
            $this->data = array();
        }
        $user_id = ANONYMOUS;
        $ali = get_variable($_CORE_CONFIG['server']['cookie_name'] . '_ali', 'COOKIE', false, 'int');
        $alc = get_variable($_CORE_CONFIG['server']['cookie_name'] . '_alc', 'COOKIE');
        if ($ali && $alc) {
            if ($id = $this->autologin_retrieve($ali, $alc)) {
                $user_id = $id;
            }
        }
        check_maintance_status();
        $this->load = check_load_status();
        return $this->login($user_id);
    }
Beispiel #2
0
    }
    while ($row = $_CLASS['core_db']->fetch_row_assoc($result)) {
        if ($row['config_type']) {
            settype($row['config_value'], $row['config_type']);
        }
        $_CORE_CONFIG[$row['config_section']][$row['config_name']] = $row['config_value'];
    }
    $_CLASS['core_db']->free_result($result);
}
$_CORE_CONFIG['email']['site_mail'] = '*****@*****.**';
$_CLASS['core_db']->report_error(true);
unset($config_error);
$_CLASS['core_cache']->remove('core_config');
$_CLASS['core_cache']->remove('config');
if (VIPERAL === 'FEED' || VIPERAL === 'AJAX') {
    if (check_maintance_status(true) === true || check_load_status(true) === true) {
        header('HTTP/1.0 503 Service Unavailable');
        script_close(false);
    }
}
/* 
	Load third Set of Classes :
		User based classes
		Display handler
*/
require SITE_FILE_ROOT . 'includes/session.php';
require SITE_FILE_ROOT . 'includes/user.php';
require SITE_FILE_ROOT . 'includes/auth/auth.php';
require SITE_FILE_ROOT . 'includes/auth/auth_db.php';
require SITE_FILE_ROOT . 'includes/display/display.php';
load_class(false, 'core_display');