public function login($tmp, $ip, $save = false) { global $bd_users, $config; if (!$this->id) { return false; } $save = $save ? true : false; if ($config['p_logic'] != 'usual' and $config['p_sync']) { MCMSAuth::login($this->id()); } $sql = "UPDATE `{$this->db}` SET `{$bd_users['deadtry']}` = '0', " . "`{$bd_users['tmp']}`=:tmp, " . "`{$bd_users['ip']}`=:ip " . "WHERE `{$bd_users['id']}`='" . $this->id . "'"; getDB()->ask($sql, array('ip' => $ip, 'tmp' => $tmp)); $this->tmp = $tmp; if (!isset($_SESSION)) { session_start(); } $_SESSION['user_id'] = $this->id(); $_SESSION['user_name'] = $this->name(); $_SESSION['ip'] = $this->ip(); if ($save) { setcookie("PRTCookie1", $tmp, time() + 60 * 60 * 24 * 30 * 12, '/'); } return true; }