function sec_login_process(&$result) { $user =& $result[F_LOGIN_USER]; sys_user_options_unpack($user); if ($user['banaday'] && $user['banaday'] <= SN_TIME_NOW) { $user['banaday'] = 0; $user['vacation'] = SN_TIME_NOW; } $ip = sec_player_ip(); $user['user_lastip'] = $ip['ip']; $user['user_proxy'] = $ip['proxy_chain']; $result[F_BANNED_STATUS] = $user['banaday']; $result[F_VACATION_STATUS] = $user['vacation']; sec_login_change_state($result); }
public function __construct() { $this->write_full_url = !classSupernova::$config->security_write_full_url_disabled; // Инфа об устройстве и браузере - общая для всех sn_db_transaction_start(); $this->device_cypher = $_COOKIE[SN_COOKIE_D]; if ($this->device_cypher) { $cypher_safe = db_escape($this->device_cypher); $device_id = doquery("SELECT `device_id` FROM {{security_device}} WHERE `device_cypher` = '{$cypher_safe}' LIMIT 1 FOR UPDATE", true); if (!empty($device_id['device_id'])) { $this->device_id = $device_id['device_id']; } } if ($this->device_id <= 0) { do { $cypher_safe = db_escape($this->device_cypher = sys_random_string()); $row = doquery("SELECT `device_id` FROM {{security_device}} WHERE `device_cypher` = '{$cypher_safe}' LIMIT 1 FOR UPDATE", true); } while (!empty($row)); doquery("INSERT INTO {{security_device}} (`device_cypher`) VALUES ('{$cypher_safe}');"); $this->device_id = db_insert_id(); sn_setcookie(SN_COOKIE_D, $this->device_cypher, PERIOD_FOREVER, SN_ROOT_RELATIVE); } sn_db_transaction_commit(); sn_db_transaction_start(); $this->user_agent = $_SERVER['HTTP_USER_AGENT']; $this->browser_id = db_get_set_unique_id_value($_SERVER['HTTP_USER_AGENT'], 'browser_id', 'security_browser', 'browser_user_agent'); sn_db_transaction_commit(); sn_db_transaction_start(); $this->page_address = substr($_SERVER['PHP_SELF'], strlen(SN_ROOT_RELATIVE)); $this->page_address_id = db_get_set_unique_id_value($this->page_address, 'url_id', 'security_url', 'url_string'); sn_db_transaction_commit(); if ($this->write_full_url) { sn_db_transaction_start(); $this->page_url = substr($_SERVER['REQUEST_URI'], strlen(SN_ROOT_RELATIVE)); if (strpos($_SERVER['REQUEST_URI'], '/simulator.php') === 0) { $this->page_url = '/simulator.php'; } $this->page_url_id = db_get_set_unique_id_value($this->page_url, 'url_id', 'security_url', 'url_string'); sn_db_transaction_commit(); } $ip = sec_player_ip(); $this->ip_v4_string = $ip['ip']; $this->ip_v4_int = ip2longu($this->ip_v4_string); $this->ip_v4_proxy_chain = $ip['proxy_chain']; }