Esempio n. 1
0
 public static function checkLogin(\PDO $pdo_db, string $lang, Reg $tkireg, Smarty $template) : bool
 {
     // Database driven language entries
     $langvars = Translate::load($pdo_db, $lang, array('login', 'global_funcs', 'common', 'footer', 'self_destruct'));
     // Check if game is closed - Ignore the false return if it is open
     Game::isGameClosed($pdo_db, $tkireg, $lang, $template, $langvars);
     // Handle authentication check - Will die if fails, or return correct playerinfo
     $playerinfo = Player::handleAuth($pdo_db, $lang, $langvars, $tkireg, $template);
     // Establish timestamp for interval in checking bans
     $stamp = date('Y-m-d H:i:s');
     $timestamp = array();
     $timestamp['now'] = (int) strtotime($stamp);
     $timestamp['last'] = (int) strtotime($playerinfo['last_login']);
     // Check for ban - Ignore the false return if not
     Player::handleBan($pdo_db, $lang, $timestamp, $template, $playerinfo, $langvars, $tkireg);
     // Check for destroyed ship - Ignore the false return if not
     Ship::isDestroyed($pdo_db, $lang, $tkireg, $langvars, $template, $playerinfo);
     return true;
 }