Exemplo n.º 1
0
} else {
    // This logic presumes nginx is being used.
    $nameVersionPair = explode('/', $request->server->get('SERVER_SOFTWARE'));
    $serverType = $nameVersionPair[0];
    $serverVersion = array_pop($nameVersionPair);
}
$variables['selected_lang'] = null;
$variables['system'] = php_uname();
$variables['remote_addr'] = $request->server->get('REMOTE_ADDR');
$variables['server_addr'] = $request->server->get('HTTP_HOST') . ':' . $request->server->get('SERVER_PORT');
$variables['zend_version'] = zend_version();
$variables['php_version'] = PHP_VERSION;
$variables['php_sapi_name'] = php_sapi_name();
$variables['server_type'] = $serverType;
$variables['server_version'] = $serverVersion;
$variables['game_path'] = Tki\SetPaths::setGamepath();
$variables['db_type'] = $db_type;
$variables['db_name'] = $db_name;
$variables['db_prefix'] = $db_prefix;
$variables['admin_name'] = $tkireg->admin_name;
$variables['admin_email'] = str_replace('@', ' AT ', $tkireg->admin_mail);
$variables['release_version'] = $tkireg->release_version;
$variables['turns_per_tick'] = $tkireg->turns_per_tick;
$variables['sched_ticks'] = $tkireg->sched_ticks;
$variables['sched_turns'] = $tkireg->sched_turns;
$variables['sched_ports'] = $tkireg->sched_ports;
$variables['sched_planets'] = $tkireg->sched_planets;
$variables['sched_ibank'] = $tkireg->sched_ibank;
$variables['sched_ranking'] = $tkireg->sched_ranking;
$variables['sched_news'] = $tkireg->sched_news;
$variables['sched_degrade'] = $tkireg->sched_degrade;
Exemplo n.º 2
0
echo "<h1>" . $title . "</h1>\n";
$result = $db->SelectLimit("SELECT character_name, email, password FROM {$db->prefix}ships WHERE email = ?", 1, -1, array('email' => $mail));
Tki\Db::LogDbErrors($pdo_db, $result, __LINE__, __FILE__);
if (!$result->EOF) {
    if ($mail == $tkireg->admin_mail) {
        echo "<div style='font-size:14px; font-weight:bold; color:#f00;'>";
        echo $langvars['l_mail_admin_denied'];
        echo "</div><br>\n";
        if ($_SESSION['logged_in'] !== null && $_SESSION['logged_in'] === true) {
            echo str_replace("[here]", "<a href='main.php'>" . $langvars['l_here'] . "</a>", $langvars['l_global_mmenu']);
        } else {
            echo str_replace("[here]", "<a href='index.php'>" . $langvars['l_here'] . "</a>", $langvars['l_global_mlogin']);
        }
    } else {
        $playerinfo = $result->fields;
        $link_to_reset = "https://" . $request->server->get('HTTP_HOST') . Tki\SetPaths::setGamepath();
        $link_to_reset .= "pwreset.php?code=" . mb_substr(md5($playerinfo['password']), 5, 8);
        $langvars['l_mail_message'] = str_replace("[link]", htmlentities($link_to_reset, ENT_QUOTES | ENT_HTML5, 'UTF-8'), $langvars['l_mail_message']);
        $langvars['l_mail_message'] = str_replace("[name]", $playerinfo['character_name'], $langvars['l_mail_message']);
        $langvars['l_mail_message'] = str_replace("[ip]", $request->server->get('REMOTE_ADDR'), $langvars['l_mail_message']);
        $langvars['l_mail_message'] = str_replace("[game_name]", $tkireg->game_name, $langvars['l_mail_message']);
        // Some reason \r\n is broken, so replace them now.
        $langvars['l_mail_message'] = str_replace('\\r\\n', "\r\n", $langvars['l_mail_message']);
        // Need to set the topic with the game name.
        $langvars['l_mail_topic'] = str_replace("[game_name]", $tkireg->game_name, $langvars['l_mail_topic']);
        // Recovery time is a timestamp at the time of recovery attempt, which is valid for 30 minutes
        // After 30 minutes, it will be cleared to null by scheduler. If it is used, it will also be cleared.
        $recovery_update_result = $db->Execute("UPDATE {$db->prefix}ships SET recovery_time=? WHERE email = ?;", array(time(), $playerinfo['email']));
        Tki\Db::LogDbErrors($pdo_db, $recovery_update_result, __LINE__, __FILE__);
        mail($playerinfo['email'], $langvars['l_mail_topic'], $langvars['l_mail_message'] . "\r\n\r\n" . htmlentities($link_to_reset, ENT_QUOTES | ENT_HTML5, 'UTF-8') . "\r\n", "From: {$tkireg->admin_mail}\r\nReply-To: {$tkireg->admin_mail}\r\nX-Mailer: PHP/" . phpversion());
        echo "<div style='color:#fff; text-align:left;'>" . $langvars['l_mail_sent'] . " <span style='color:#0f0;'>{$mail}</span></div>\n";
Exemplo n.º 3
0
 $hashed_pass = password_hash($filtered_post_password, PASSWORD_DEFAULT);
 // PASSWORD_DEFAULT is the strongest algorithm available to PHP at the current time - today, it is BCRYPT.
 $result2 = $db->Execute("INSERT INTO {$db->prefix}ships (ship_name, ship_destroyed, character_name, password, email, armor_pts, credits, ship_energy, ship_fighters, turns, on_planet, dev_warpedit, dev_genesis, dev_beacon, dev_emerwarp, dev_escapepod, dev_fuelscoop, dev_minedeflector, last_login, ip_address, trade_colonists, trade_fighters, trade_torps, trade_energy, cleared_defenses, lang, dev_lssd)\n                             VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?);", array($shipname, 'N', $character, $hashed_pass, $username, $tkireg->start_armor, $tkireg->start_credits, $tkireg->start_energy, $tkireg->start_fighters, $mturns, 'N', $tkireg->start_editors, $tkireg->start_genesis, $tkireg->start_beacon, $tkireg->start_emerwarp, $tkireg->start_escape_pod, $tkireg->start_scoop, $tkireg->start_minedeflectors, $stamp, $request->server->get('REMOTE_ADDR'), 'Y', 'N', 'N', 'Y', NULL, $lang, $tkireg->start_lssd));
 Tki\Db::LogDbErrors($pdo_db, $result2, __LINE__, __FILE__);
 if (!$result2) {
     echo $db->ErrorMsg() . '<br>';
 } else {
     $result2 = $db->Execute("SELECT ship_id FROM {$db->prefix}ships WHERE email = ?;", array($username));
     Tki\Db::LogDbErrors($pdo_db, $result2, __LINE__, __FILE__);
     $shipid = $result2->fields;
     // To do: build a bit better "new player" message
     $langvars['l_new_message'] = str_replace('[pass]', $filtered_post_password, $langvars['l_new_message']);
     $langvars['l_new_message'] = str_replace('[ip]', $request->server->get('REMOTE_ADDR'), $langvars['l_new_message']);
     // Some reason \r\n is broken, so replace them now.
     $langvars['l_new_message'] = str_replace('\\r\\n', "\r\n", $langvars['l_new_message']);
     $link_to_game_unsafe = 'https://' . $request->server->get('HTTP_HOST') . Tki\SetPaths::setGamepath();
     $link_to_game = htmlentities($link_to_game_unsafe, ENT_QUOTES | ENT_HTML5, 'UTF-8');
     $langvars['l_new_message'] = str_replace('[website]', $link_to_game, $langvars['l_new_message']);
     $langvars['l_new_message'] = str_replace('[npg]', $link_to_game . 'newplayerguide.php', $langvars['l_new_message']);
     $langvars['l_new_message'] = str_replace('[faq]', $link_to_game . 'faq.php', $langvars['l_new_message']);
     $langvars['l_new_message'] = str_replace('[forums]', 'https://kabal-invasion.com/forums/', $langvars['l_new_message']);
     mail("{$username}", $langvars['l_new_topic'], $langvars['l_new_message'] . "\r\n\r\n" . $link_to_game, 'From: ' . $tkireg->admin_mail . "\r\nReply-To: " . $tkireg->admin_mail . "\r\nX-Mailer: PHP/" . phpversion());
     Tki\LogMove::writeLog($pdo_db, $shipid['ship_id'], 0);
     // A new player is placed into sector 0. Make sure his movement log shows it, so they see it on the galaxy map.
     $resx = $db->Execute("INSERT INTO {$db->prefix}zones VALUES (NULL, ?, ?, 'N', 'Y', 'Y', 'Y', 'Y', 'Y', 'Y', 'Y', 0);", array($character . "\\'s Territory", $shipid['ship_id']));
     Tki\Db::LogDbErrors($pdo_db, $resx, __LINE__, __FILE__);
     $resx = $db->Execute("INSERT INTO {$db->prefix}ibank_accounts (ship_id,balance,loan) VALUES (?,0,0);", array($shipid['ship_id']));
     Tki\Db::LogDbErrors($pdo_db, $resx, __LINE__, __FILE__);
     // Add presets for new player
     for ($zz = 0; $zz < $tkireg->max_presets; $zz++) {
         $sql = "INSERT INTO ::prefix::presets (ship_id, preset, type) " . "VALUES (:ship_id, :preset, :type)";