public function last_activity_stamp($ship_id) { global $db_prefix; $manage_log = new manage_log(); $shared_function = new shared(); if ($ship_id > 0) { $timestamp = $shared_function->manage_time("full"); $timestamp_ship = $this->connect->prepare("UPDATE " . $db_prefix . "ships SET last_login='******' WHERE ship_id='" . $ship_id . "'"); if ($timestamp_ship->execute()) { } else { } } else { } }
private function _checkLogin() { $shared_function = new shared(); $this->_isLogged = false; $time_date_full = $shared_function->manage_time("full"); if (isset($_SESSION['logged']) && $_SESSION['logged']) { $sth = $this->connect->query("SELECT * FROM WHERE user_id = " . $_SESSION['user_id']); $result = $sth->fetch(); if ($result['ip'] == $_SESSION['ip']) { $this->_isLogged = true; $this->_isFullName = $result['name']; $this->_isUsername = $result['username']; $this->_isIndentification = $result['facebook_id']; $this->_isDatabaseID = $result['user_id']; } } else { if (isset($_COOKIE['XRLogin']) && $_COOKIE['XRLogin']) { $cookieData = unserialize(stripslashes($_COOKIE['XRLogin'])); $sth = $this->connect->query("SELECT * FROM WHERE user_id = " . $cookieData['user_id']); $result = $sth->fetch(); if ($result['ip'] == $cookieData['ip']) { $this->_isLogged = true; $this->_setLogin($result); $this->_isFullName = $result['name']; $this->_isUsername = $result['username']; $this->_isIndentification = $result['facebook_id']; $this->_isDatabaseID = $result['user_id']; } } } if ($this->_isDatabaseID > 0) { $sth = $this->connect->prepare("UPDATE SET last_activity = ? WHERE user_id = ?"); if ($sth->execute(array($time_date_full, $this->_isDatabaseID))) { //update successful } else { //user not logged in } } }
exit; } } $sth = $db->prepare("SELECT * FROM " . $db_prefix . "account WHERE username = ?"); $sth->execute(array($register['username'])); if (!$sth->fetch()) { $sth = $db->prepare("SELECT * FROM " . $db_prefix . "account WHERE email = ?"); $sth->execute(array($register['email'])); if (false != $sth->fetch() && $fbId != 0) { $sth = $db->prepare("UPDATE " . $db_prefix . "account SET facebook_id = ? WHERE email = ?"); if ($sth->execute(array($fbId, $register['email']))) { $status = $user->fbLogin($fbId); } } else { $shared_function = new shared(); $time_date_full = $shared_function->manage_time("full"); $location = $register['location']; if (is_array($location)) { $location = $location['name']; } if ($fbId > 1) { #user has a facebook id, use it $account_id = $fbId; } else { #create a randomly large id $account_id = rand(1, 999) . rand(1, 999) . rand(1, 999); } $sql = "INSERT INTO " . $db_prefix . "account (facebook_id, username, password, name, email, location, gender, ip, registration_date, handle, active_ship, user_id) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)"; $data = array($fbId, $register['username'], md5($register['password']), $register['name'], $register['email'], $location, $register['gender'], $_SERVER['REMOTE_ADDR'], $time_date_full, $register['handle'], 0, $account_id); $sth = $db->prepare($sql); if ($sth->execute($data)) {
public function player_log($user_id, $event_id, $a, $b, $c, $tracking, $log_priority, $log_title) { global $db_prefix; $shared_function = new shared(); if ($tracking == "notrack") { $user_ip_address = ""; $user_agent = ""; $user_host = ""; } else { $ip_array = $shared_function->sortIP(); $user_ip_address = $ip_array[0]; $user_agent = $_SERVER['HTTP_USER_AGENT']; $user_host = gethostbyaddr($_SERVER['REMOTE_ADDR']); } $event_content = $this->player_log_data($event_id, $a, $b, $c, $ip_array); $timestamp = $shared_function->manage_time("full"); $create_log = $this->connect->prepare("INSERT INTO " . $db_prefix . "player_logs SET ship_id = ? , type = ? , time = ?, data = ?, user_agent = ?, user_host = ?, user_ip = ?, priority = ?, title = ?"); $create_log->bindParam(1, $user_id, PDO::PARAM_INT); $create_log->bindParam(2, $event_id, PDO::PARAM_INT); $create_log->bindParam(3, $timestamp, PDO::PARAM_STR); $create_log->bindParam(4, $event_content, PDO::PARAM_STR); $create_log->bindParam(5, $user_agent, PDO::PARAM_STR); $create_log->bindParam(6, $user_host, PDO::PARAM_STR); $create_log->bindParam(7, $user_ip_address, PDO::PARAM_STR); $create_log->bindParam(8, $log_priority, PDO::PARAM_STR); $create_log->bindParam(9, $log_title, PDO::PARAM_STR); if ($create_log->execute()) { # Do nothing, log was created!!! # } else { # Log failed to work..... log this in the admin logs.... hopefully it will work there?! # if ($user_id > 0) { /*username is valid... why else would the log fail?*/ if ($event_id > 0) { /*NO other known reason this should be failing.*/ $this->security_log($user_id, 3, $create_log->errorInfo()); } else { /*Invalid Event ID*/ $this->security_log($user_id, 2, $event_id); } } else { /*Invalid User ID*/ $this->security_log(0, 1, $event_id); } } }