Esempio n. 1
0
 }
 $db->query("SELECT * FROM {$table} WHERE {$id} > 0 AND {$per} > 0 ORDER BY {$id} / {$per} DESC LIMIT {$amount}");
 print "{$first_display}<br><br>View your rank at the bottom of the screen<br><br>";
 if ($db->nf()) {
     //we have people who meet this category
     print_table();
     print "<tr>";
     print "<th align=\"center\">Rank</th>";
     print "<th align=\"center\">Player</th>";
     print "<th align=\"center\">{$second_display}</th>";
     print "</tr>";
     $count = 1;
     $db4 = new SmrMySqlDatabase();
     while ($db->next_record()) {
         //get the account
         $curr_account = new SMR_ACCOUNT();
         $acc_id = $db->f("account_id");
         $db4->query("SELECT * FROM account WHERE account_id = {$acc_id}");
         if (!$db4->next_record()) {
             continue;
         }
         $curr_account->get_by_id($db->f("account_id"));
         $name = stripslashes($curr_account->HoF_name);
         print "<tr>";
         print "<td align=\"center\">{$count}</td>";
         $count++;
         print "<td align=center>{$name}</td>";
         print "<td align=center> " . number_format($db->f("{$id}") / $db->f("{$per}"), 2) . " </td>";
         print "</tr>";
     }
     print "</table>";
$container["body"] = "hall_of_fame_new.php";
if (isset($game_id)) {
    $container["game_id"] = $game_id;
}
print_link($container, "<b>&lt;&lt;Back</b>");
print "<br>";
print "Here are the ranks of players by {$cat} {$action}<br><br>";
print_table();
print "<tr><th align=center>Rank</th><th align=center>Player</th><th align=center>{$cat} {$action}</th></tr>";
if ($cat == "<b>Money Donated to SMR</b>") {
    $db->query("SELECT account_id, sum(amount) as amount FROM account_donated " . "GROUP BY account_id ORDER BY amount DESC LIMIT 25");
} else {
    $db->query("SELECT account_id, {$row} as amount FROM {$table} {$row} > 0 ORDER BY amount DESC LIMIT 25");
}
while ($db->next_record()) {
    $this_acc = new SMR_ACCOUNT();
    $this_acc->get_by_id($db->f("account_id"));
    if ($db->f("account_id") == ".SmrSession::{$old_account_id}.") {
        $bold = " style=\"font-weight:bold;\"";
    } else {
        $bold = "";
    }
    print "<tr>";
    print "<td align=center{$bold}>" . $rank++ . "</td>";
    //link to stat page
    $container = array();
    $container["url"] = "skeleton.php";
    $container["body"] = "hall_of_fame_player_detail.php";
    $container["acc_id"] = $db->f("account_id");
    if (isset($game_id)) {
        $container["game_id"] = $game_id;
<?php

require_once get_file_loc('smr_alliance.inc');
$alliance = new SMR_ALLIANCE($player->alliance_id, SmrSession::$game_id);
$account_id = $_REQUEST['account_id'];
foreach ($account_id as $id) {
    if ($id == $alliance->leader_id) {
        create_error("You can't remove the leader!");
    }
    // generate list of messages that should be deleted
    if ($account_id_list) {
        $account_id_list .= ",";
    }
    $account_id_list .= $id;
    $player->send_message($id, 2, format_string("You were kicked out of the alliance!", false));
    $curr_acc = new SMR_ACCOUNT();
    $curr_acc->get_by_id($id);
    $curr_acc->log(3, "kicked from alliance: {$alliance->alliance_name} by leader", 0);
}
$db->query("UPDATE player SET alliance_id = 0 WHERE account_id IN ({$account_id_list}) AND " . "game_id = {$player->game_id}");
$db->query("DELETE FROM player_has_alliance_role WHERE game_id = {$player->game_id} AND account_id IN ({$account_id_list})");
forward(create_container("skeleton.php", "alliance_roster.php"));
Esempio n. 4
0
    }
    // decide if it's an friendly or enemy stack
    $forces_owner = new SMR_PLAYER($db->f("owner_id"), $player->game_id);
    $forces = new SMR_FORCE($db->f("owner_id"), $var["target_sector"], $player->game_id);
    if ($player->alliance_id == 0 && $forces->owner_id == $player->account_id || $player->alliance_id != 0 && $player->alliance_id == $forces_owner->alliance_id) {
        $friendly_forces += $forces->mines * 3 + $forces->combat_drones * 2 + $forces->scout_drones;
    } else {
        $enemy_forces += $forces->mines * 3 + $forces->combat_drones * 2 + $forces->scout_drones;
    }
}
$last_active = time() - 259200;
$db->query("SELECT * FROM player WHERE game_id = {$player->game_id} AND " . "sector_id = " . $var["target_sector"] . " AND " . "last_active > {$last_active} AND " . "land_on_planet = 'FALSE' AND " . "account_id NOT IN (" . implode(',', $HIDDEN_PLAYERS) . ")");
while ($db->next_record()) {
    // we may skip player if this is a protected gal.
    if ($sector->is_protected_gal()) {
        $curr_account = new SMR_ACCOUNT();
        $curr_account->get_by_id($db->f("account_id"));
        // if one is vet and the other is newbie we skip it
        if (different_level($rank_id, $curr_account->get_rank(), $account->veteran, $curr_account->veteran)) {
            continue;
        }
    }
    $curr_player = new SMR_PLAYER($db->f("account_id"), $player->game_id);
    $curr_ship = new SMR_SHIP($db->f("account_id"), $player->game_id);
    // he's a friend if he's in our alliance (and we are not in a 0 alliance
    if ($player->alliance_id != 0 && $curr_player->alliance_id == $player->alliance_id) {
        $friendly_vessel += $curr_ship->attack_rating();
    } else {
        $enemy_vessel += $curr_ship->defense_rating() * 10;
    }
}
Esempio n. 5
0
function displayMessage($message_id, $sender_id, $message_text, $send_time, $msg_read, $type)
{
    global $player, $account;
    $replace = explode("!", $message_text);
    foreach ($replace as $key => $timea) {
        if (($final = strtotime($timea)) !== false && $timea != "") {
            $final += $account->offset * 3600;
            $message_text = str_replace("!{$timea}!", date("n/j/Y g:i:s A", $final), "{$message_text}");
        }
    }
    $replace = explode("?", $message_text);
    foreach ($replace as $key => $timea) {
        if (($final = strtotime($timea)) !== false && $sender_id > 0 && $timea != "") {
            $send_acc = new SMR_ACCOUNT();
            $send_acc->get_by_id($sender_id);
            $final += $account->offset * 3600 - $send_acc->offset * 3600;
            $message_text = str_replace("?{$timea}?", date("n/j/Y g:i:s A", $final), "{$message_text}");
        }
    }
    if (!empty($sender_id)) {
        $sender = new SMR_PLAYER($sender_id, $player->game_id);
    }
    print "<tr>";
    print "<td width=\"10\"><input type=\"checkbox\" name=\"message_id[]\" value=\"{$message_id}\">";
    // remember id for marking as read
    if ($msg_read == 'FALSE') {
        print "*";
    }
    print "</td>";
    print "<td nowrap=\"nowrap\" width=\"100%\">From: ";
    if (!empty($sender_id)) {
        $container = array();
        $container["url"] = "skeleton.php";
        $container["body"] = "trader_search_result.php";
        $container["player_id"] = $sender->player_id;
        print_link($container, $sender->get_colored_name());
    } else {
        if ($type == 7) {
            print "<span style=\"font:small-caps bold;color:blue;\">Administrator</span>";
        } elseif ($type == 6) {
            print "<span class=\"green\">";
            print "Alliance Ambassador";
            print "</span>";
        } elseif ($type == 2) {
            print "<span class=\"yellow\">Port Defenses</span>";
        } else {
            print "Unknown";
        }
    }
    print "</td>";
    print "<td nowrap=\"nowrap\">Date: " . date("n/j/Y g:i:s A", $send_time) . "</td>";
    print "<td>";
    $container = array();
    $container["url"] = "skeleton.php";
    $container["body"] = "message_notify_confirm.php";
    $container["message_id"] = $message_id;
    $container["sent_time"] = $send_time;
    $container["notified_time"] = time();
    print_link($container, "<img src=\"images/notify.gif\" border=\"0\" align=\"right\"title=\"Report this message to an admin\">");
    print "</td>";
    print "</tr>";
    print "<tr>";
    print "<td colspan=\"4\">{$message_text}</td>";
    print "</tr>";
}
        create_error("You Hall of Fame name must contain characters!");
    }
    //no duplicates
    $db->query("SELECT * FROM account_has_stats WHERE HoF_name = " . format_string($HoF_name, true) . " AND account_id <> {$account->account_id}");
    if ($db->next_record()) {
        create_error("Someone is already using that name!");
    }
    // set the HoF name in account stat
    $db->query("UPDATE account_has_stats SET HoF_name = " . format_string($HoF_name, true) . " WHERE account_id = {$account->account_id}");
} elseif ($action == "Yes") {
    $account_id = $var["account_id"];
    $amount = $var["amount"];
    // take from us
    $account->set_credits($account->get_credits() - $amount);
    // create his account
    $his_account = new SMR_ACCOUNT();
    $his_account->get_by_id($account_id);
    // add to him
    $his_account->set_credits($his_account->get_credits() + $amount);
} elseif ($action == "Change Timezone") {
    $timez = $_REQUEST['timez'];
    if (!is_numeric($timez)) {
        create_error("Numbers only please");
    }
    $db->query("UPDATE account SET offset = {$timez} WHERE account_id = " . SmrSession::$old_account_id);
} elseif ($action == "Change") {
    $account->images = $_REQUEST['images'];
    $account->update();
} else {
    if ($action == "Change Size" && is_numeric($_REQUEST['fontsize']) && $_REQUEST['fontsize'] > 50) {
        $db->query("UPDATE account SET fontsize=" . $_REQUEST['fontsize'] . " WHERE account_id = " . SmrSession::$old_account_id);
Esempio n. 7
0
 // *
 // * Get Hidden Admins
 // *
 // ********************************
 $db->query("SELECT account_id FROM hidden_players");
 $HIDDEN_PLAYERS = array(0);
 while ($db->next_record()) {
     $HIDDEN_PLAYERS[] = $db->f("account_id");
 }
 // ********************************
 // *
 // * A c c o u n t
 // *
 // ********************************
 // create account object
 $account = new SMR_ACCOUNT();
 // get account from db
 $account->get_by_id(SmrSession::$old_account_id);
 // ********************************
 // *
 // * g e t   S e s s i o n
 // *
 // ********************************
 $sn = $_REQUEST['sn'];
 // check if we got a sn number with our url
 if (empty($sn)) {
     create_error('Your browser lost the SN. Try to reload the page!');
 }
 // do we have such a container object in the db?
 if (!($var = SmrSession::retrieveVar($sn))) {
     create_error('Please avoid using the back button!');
Esempio n. 8
0
    } else {
        print ".<br>";
    }
}
print "The traders listed in <span style=\"font-style:italic;\">italics</span> are still ranked as Newbie or Beginner.</p>";
$player = new SMR_PLAYER($account->account_id, $game_id);
if ($count_last_active > 0) {
    print "<table cellspacing=\"0\" cellpadding=\"5\" border=\"0\" class=\"standard\" width=\"95%\">";
    print "<tr>";
    print "<th>Player</th>";
    print "<th>Race</th>";
    print "<th>Alliance</th>";
    print "<th>Experience</th>";
    print "</tr>";
    while ($db->next_record()) {
        $curr_account = new SMR_ACCOUNT();
        $curr_account->get_by_id($db->f("account_id"));
        //reset style
        $style = "";
        $curr_player = new SMR_PLAYER($db->f("account_id"), $game_id);
        if ($curr_account->veteran == "FALSE" && $curr_account->get_rank() < FLEDGLING) {
            $style = "font-style:italic;";
        }
        if ($curr_player->account_id == $account->account_id) {
            $style .= "font-weight:bold;";
        }
        if (!empty($style)) {
            $style = " style=\"{$style}\"";
        }
        print "<tr>";
        print "<td valign=\"top\"{$style}>{$curr_player->display_level_name} ";
<?php

require_once get_file_loc("smr_history_db.inc");
function cust_round($x)
{
    return round($x / 10) * 10;
}
$acc_id = $var["acc_id"];
//view rankings of other players
$this_acc = new SMR_ACCOUNT();
$this_acc->get_by_id($acc_id);
$rank_id = $this_acc->get_rank();
$game_id = $var["game_id"];
$hof_name = stripslashes($this_acc->HoF_name);
$db->query("SELECT * FROM rankings WHERE rankings_id = {$rank_id}");
if ($db->next_record()) {
    $rank_name = $db->f("rankings_name");
}
// initialize vars
$kills = 0;
$exp = 0;
// get stats
$db->query("SELECT * from account_has_stats_cache WHERE account_id = {$this_acc->account_id}");
if ($db->next_record()) {
    $kills = $db->f("kills") > 0 ? $db->f("kills") : 0;
    $exp = $db->f("experience_traded") > 0 ? $db->f("experience_traded") : 0;
}
if ($var['sending_page'] == 'hof') {
    print_topic("Extended User Rankings for {$hof_name}");
    print "{$hof_name} has <font color=\"red\">{$kills}</font> kills and <font color=\"red\">{$exp}</font> traded experience<br><br>";
    print "{$hof_name} is ranked as a <font size=\"4\" color=\"greenyellow\">{$rank_name}</font> player.<br><br>";
Esempio n. 10
0
 $container["sort"] = "race_id";
 print "<th>";
 print_link($container, "<font color=#80c870>Race</font>");
 print "</th>";
 $container["sort"] = "alliance_id";
 print "<th>";
 print_link($container, "<font color=#80c870>Alliance</font>");
 print "</th>";
 $container["sort"] = "experience";
 print "<th>";
 print_link($container, "<font color=#80c870>Experience</font>");
 print "</th>";
 print "</tr>";
 //while ($db->next_record()) {
 foreach ($exp as $acc_id => $exp) {
     $curr_account = new SMR_ACCOUNT();
     $curr_account->get_by_id($acc_id);
     //reset style
     $style = "";
     $curr_player = new SMR_PLAYER($acc_id, SmrSession::$game_id);
     $curr_player->get_display_xp_lvl();
     if ($curr_account->veteran == "FALSE" && $curr_account->get_rank() < FLEDGLING) {
         $style = "font-style:italic;";
     }
     if ($curr_player->account_id == $player->account_id) {
         $style .= "font-weight:bold;";
     }
     $fullStyle = '';
     if (!empty($style)) {
         $fullStyle = " style=\"{$style}\"";
     }
Esempio n. 11
0
release_lock();
// We need a lock on the new sector so that more than one person isn't hitting the same mines
acquire_lock($player->sector_id);
// delete plotted course
$db->query("DELETE FROM player_plotted_course " . "WHERE account_id = {$player->account_id} AND " . "game_id = {$player->game_id}");
// get new sector object
$sector = new SMR_SECTOR($player->sector_id, $player->game_id, $player->account_id);
// make current sector visible to him
$sector->mark_visited();
// send scout msg
$sector->entering_sector();
$db->query("SELECT * FROM sector_has_forces, player " . "WHERE sector_has_forces.game_id = player.game_id AND " . "sector_has_forces.owner_id = player.account_id AND " . "sector_has_forces.game_id = {$player->game_id} AND " . "sector_has_forces.sector_id = {$player->sector_id} AND " . "mines > 0 AND " . "owner_id != {$player->account_id} AND " . "(alliance_id != {$player->alliance_id} OR alliance_id = 0)");
while ($db->next_record()) {
    // we may skip forces if this is a protected gal.
    if ($sector->is_protected_gal()) {
        $forces_account = new SMR_ACCOUNT();
        $forces_account->get_by_id($db->f("owner_id"));
        // if one is vet and the other is newbie we skip it
        if (different_level($rank_id, $forces_account->get_rank(), $account->veteran, $forces_account->veteran)) {
            continue;
        }
    }
    if ($player->newbie_turns > 0) {
        $container = array();
        $container["url"] = "skeleton.php";
        $container["body"] = "current_sector.php";
        $container["msg"] = "You have just flown past a sprinkle of mines.<br>Because of your newbie status you have been spared from the harsh reality of the forces.";
        forward($container);
    } else {
        $owner_id = $db->f("owner_id");
        include "forces_minefield_processing.php";