예제 #1
0
function ini_to_db($db, $ini_file, $ini_table, $language)
{
    // This is a loop, that reads a ini file, of the type variable = value.
    // It will loop thru the list of the ini variables, and push them into the db.
    $ini_keys = parse_ini_file($ini_file, true);
    $status = true;
    // This variable allows us to track the inserts into the databse. If one fails, the whole process is considered failed.
    $resa = $db->StartTrans();
    // We enclose the inserts in a transaction as it is roughly 30 times faster
    db_op_result($db, $resa, __LINE__, __FILE__);
    foreach ($ini_keys as $config_category => $config_line) {
        foreach ($config_line as $config_key => $config_value) {
            // We have to ensure that the language string (config_value) is utf8 encoded before sending to the database
            $config_value = utf8_encode($config_value);
            $debug_query = $db->Execute("INSERT into {$db->prefix}{$ini_table} (name, category, value, language) VALUES (?,?,?,?)", array($config_key, $config_category, $config_value, $language));
            db_op_result($db, $debug_query, __LINE__, __FILE__);
            if (!$debug_query) {
                $status = false;
            }
        }
    }
    $trans_status = $db->CompleteTrans();
    // Complete the transaction
    db_op_result($db, $trans_status, __LINE__, __FILE__);
    if ($trans_status && $status) {
        return true;
    } else {
        return false;
    }
}
function player_insignia_name($db, $a_username)
{
    global $l;
    unset($player_insignia);
    // Lookup players score.
    $res = $db->Execute("SELECT score FROM {$db->prefix}ships WHERE ship_id=?", array($a_username));
    db_op_result($db, $res, __LINE__, __FILE__);
    $playerinfo = $res->fields;
    for ($i = 0; $i < 20; $i++) {
        $value = pow(2, $i * 2);
        if (!$value) {
            // Pow returned false so we need to return an error.
            $player_insignia = "<span style='color:#f00;'>ERR</span> [<span style='color:#09f; font-size:12px; cursor:help;' title='Error looking up insignia, please report this error.'>?</span>]";
            break;
        }
        $value *= 500 * 2;
        if ($playerinfo['score'] <= $value) {
            // Ok we have found our Insignia, now set and break out of the for loop.
            $temp_insignia = "l_insignia_" . $i;
            $player_insignia = $l->get($temp_insignia);
            break;
        }
    }
    if (!isset($player_insignia)) {
        // Hmm, player has out ranked out highest rank, so just return that.
        $player_insignia = $l->get('l_insignia_19');
    }
    return $player_insignia;
}
예제 #3
0
function get_player_name($userid)
{
    global $db, $db_logging;
    $query = $db->Execute("SELECT character_name FROM {$db->prefix}ships WHERE ship_id='{$userid}'");
    db_op_result($db, $query, __LINE__, __FILE__, $db_logging);
    $name = $query->fields;
    return $name['character_name'];
}
예제 #4
0
function xenoberegen()
{
    global $playerinfo, $xen_unemployment, $xenobeisdead, $db;
    // Xenobe Unempoyment Check
    $playerinfo['credits'] = $playerinfo['credits'] + $xen_unemployment;
    $maxenergy = NUM_ENERGY($playerinfo['power']);
    // Regenerate energy
    if ($playerinfo['ship_energy'] <= $maxenergy - 50) {
        $playerinfo['ship_energy'] = $playerinfo['ship_energy'] + round(($maxenergy - $playerinfo['ship_energy']) / 2);
        // Regen half of remaining energy
        $gene = "regenerated Energy to {$playerinfo['ship_energy']} units,";
    }
    $maxarmor = NUM_ARMOR($playerinfo['armor']);
    // Regenerate armor
    if ($playerinfo['armor_pts'] <= $maxarmor - 50) {
        $playerinfo['armor_pts'] = $playerinfo['armor_pts'] + round(($maxarmor - $playerinfo['armor_pts']) / 2);
        // Regen half of remaining armor
        $gena = "regenerated Armor to {$playerinfo['armor_pts']} points,";
    }
    // Buy fighters & torpedos at 6 credits per fighter
    $available_fighters = NUM_FIGHTERS($playerinfo['computer']) - $playerinfo['ship_fighters'];
    if ($playerinfo['credits'] > 5 && $available_fighters > 0) {
        if (round($playerinfo['credits'] / 6) > $available_fighters) {
            $purchase = $available_fighters * 6;
            $playerinfo['credits'] = $playerinfo['credits'] - $purchase;
            $playerinfo['ship_fighters'] = $playerinfo['ship_fighters'] + $available_fighters;
            $genf = "purchased {$available_fighters} fighters for {$purchase} credits,";
        }
        if (round($playerinfo['credits'] / 6) <= $available_fighters) {
            $purchase = round($playerinfo['credits'] / 6);
            $playerinfo['ship_fighters'] = $playerinfo['ship_fighters'] + $purchase;
            $genf = "purchased {$purchase} fighters for {$playerinfo['credits']} credits,";
            $playerinfo['credits'] = 0;
        }
    }
    // Xenobe pay 3 credits per torpedo
    $available_torpedoes = NUM_TORPEDOES($playerinfo['torp_launchers']) - $playerinfo['torps'];
    if ($playerinfo['credits'] > 2 && $available_torpedoes > 0) {
        if (round($playerinfo['credits'] / 3) > $available_torpedoes) {
            $purchase = $available_torpedoes * 3;
            $playerinfo['credits'] = $playerinfo['credits'] - $purchase;
            $playerinfo['torps'] = $playerinfo['torps'] + $available_torpedoes;
            $gent = "purchased {$available_torpedoes} torpedoes for {$purchase} credits,";
        }
        if (round($playerinfo['credits'] / 3) <= $available_torpedoes) {
            $purchase = round($playerinfo['credits'] / 3);
            $playerinfo['torps'] = $playerinfo['torps'] + $purchase;
            $gent = "purchased {$purchase} torpedoes for {$playerinfo['credits']} credits,";
            $playerinfo['credits'] = 0;
        }
    }
    // Update Xenobe record
    $resg = $db->Execute("UPDATE {$db->prefix}ships SET ship_energy=?, armor_pts=?, ship_fighters=?, torps=?, credits=? WHERE ship_id=?", array($playerinfo['ship_energy'], $playerinfo['armor_pts'], $playerinfo['ship_fighters'], $playerinfo['torps'], $playerinfo['credits'], $playerinfo['ship_id']));
    db_op_result($db, $resg, __LINE__, __FILE__);
    if (!$gene == '' || !$gena == '' || !$genf == '' || !$gent == '') {
        playerlog($db, $playerinfo[ship_id], LOG_RAW, "Xenobe {$gene} {$gena} {$genf} {$gent} and has been updated.");
    }
}
예제 #5
0
function playerlog($db, $sid, $log_type, $data = "")
{
    $data = addslashes($data);
    // Write log_entry to the player's log - identified by player's ship_id - sid.
    if ($sid != "" && !empty($log_type)) {
        $resa = $db->Execute("INSERT INTO {$db->prefix}logs VALUES(NULL, ?, ?, NOW(), ?)", array($sid, $log_type, $data));
        db_op_result($db, $resa, __LINE__, __FILE__);
    }
}
function message_defence_owner($db, $sector, $message)
{
    $result3 = $db->Execute("SELECT * FROM {$db->prefix}sector_defence WHERE sector_id=?", array($sector));
    db_op_result($db, $result3, __LINE__, __FILE__);
    if ($result3 instanceof ADORecordSet) {
        while (!$result3->EOF) {
            playerlog($db, $result3->fields['ship_id'], LOG_RAW, $message);
            $result3->MoveNext();
        }
    }
}
예제 #7
0
function get_player($db, $ship_id)
{
    global $db_logging;
    $res = $db->Execute("SELECT character_name FROM {$db->prefix}ships WHERE ship_id = ?;", array($ship_id));
    db_op_result($db, $res, __LINE__, __FILE__, $db_logging);
    if ($res) {
        $row = $res->fields;
        $character_name = $row['character_name'];
        return $character_name;
    } else {
        return "Unknown";
    }
}
예제 #8
0
function adminlog($db, $log_type, $data = "")
{
    // Write log_entry to the admin log
    $ret = (bool) false;
    $data = addslashes($data);
    if (!empty($log_type)) {
        $ret = $db->Execute("INSERT INTO {$db->prefix}logs VALUES (NULL, 0, ?, NOW(), ?)", array($log_type, $data));
        db_op_result($db, $ret, __LINE__, __FILE__);
    }
    if (!$ret) {
        return (bool) false;
    } else {
        return (bool) true;
    }
}
예제 #9
0
function db_kill_player($ship_id, $remove_planets = false)
{
    global $default_prod_ore;
    global $default_prod_organics;
    global $default_prod_goods;
    global $default_prod_energy;
    global $default_prod_fighters;
    global $default_prod_torp;
    global $db, $l;
    $resa = $db->Execute("UPDATE {$db->prefix}ships SET ship_destroyed='Y', on_planet='N', sector=0, cleared_defences=' ' WHERE ship_id=?", array($ship_id));
    db_op_result($db, $resa, __LINE__, __FILE__);
    $resb = $db->Execute("DELETE FROM {$db->prefix}bounty WHERE placed_by = ?", array($ship_id));
    db_op_result($db, $resb, __LINE__, __FILE__);
    $res = $db->Execute("SELECT DISTINCT sector_id FROM {$db->prefix}planets WHERE owner=? AND base='Y'", array($ship_id));
    db_op_result($db, $res, __LINE__, __FILE__);
    $i = 0;
    while (!$res->EOF && $res) {
        $sectors[$i] = $res->fields['sector_id'];
        $i++;
        $res->MoveNext();
    }
    if ($remove_planets == true && $ship_id > 0) {
        $resc = $db->Execute("DELETE FROM {$db->prefix}planets WHERE owner = ?", array($ship_id));
        db_op_result($db, $resc, __LINE__, __FILE__);
    } else {
        $resd = $db->Execute("UPDATE {$db->prefix}planets SET owner=0, corp=0, fighters=0, base='N' WHERE owner=?", array($ship_id));
        db_op_result($db, $resd, __LINE__, __FILE__);
    }
    if (!empty($sectors)) {
        foreach ($sectors as $sector) {
            calc_ownership($sector);
        }
    }
    $rese = $db->Execute("DELETE FROM {$db->prefix}sector_defence WHERE ship_id=?", array($ship_id));
    db_op_result($db, $rese, __LINE__, __FILE__);
    $res = $db->Execute("SELECT zone_id FROM {$db->prefix}zones WHERE corp_zone='N' AND owner=?", array($ship_id));
    db_op_result($db, $res, __LINE__, __FILE__);
    $zone = $res->fields;
    $resf = $db->Execute("UPDATE {$db->prefix}universe SET zone_id=1 WHERE zone_id=?", array($zone['zone_id']));
    db_op_result($db, $resf, __LINE__, __FILE__);
    $query = $db->Execute("SELECT character_name FROM {$db->prefix}ships WHERE ship_id=?", array($ship_id));
    db_op_result($db, $query, __LINE__, __FILE__);
    $name = $query->fields;
    $headline = $name['character_name'] . $l->get('l_killheadline');
    $newstext = str_replace("[name]", $name['character_name'], $l->get('l_news_killed'));
    $news = $db->Execute("INSERT INTO {$db->prefix}news (headline, newstext, user_id, date, news_type) VALUES (?,?,?,NOW(), 'killed')", array($headline, $newstext, $ship_id));
    db_op_result($db, $news, __LINE__, __FILE__);
}
예제 #10
0
function get_planet_owner_information($db = null, $planetID = null, &$ownerInfo = null)
{
    $ownerInfo = null;
    if (!is_null($planetID) && is_numeric($planetID) && $planetID > 0) {
        $sql = "SELECT ship_id, character_name, team FROM {$db->prefix}planets ";
        $sql .= "LEFT JOIN {$db->prefix}ships ON {$db->prefix}ships.ship_id = {$db->prefix}planets.owner ";
        $sql .= "WHERE {$db->prefix}planets.planet_id=?;";
        $res = $db->Execute($sql, array($planetID));
        db_op_result($db, $res, __LINE__, __FILE__);
        if ($res->RecordCount() > 0) {
            $ownerInfo = (array) $res->fields;
            return true;
        }
    }
    return false;
}
예제 #11
0
 public function get($langvar = null)
 {
     // Reach out and grab the global db and language variables (so we don't have to pass them in every language string echo)
     global $db, $lang;
     // Sanity checking to ensure everything exists before we waste an SQL call
     if (is_null($db) || is_null($lang) || is_null($langvar)) {
         return false;
     }
     // Do a cached select from the database and return the value of the language variable requested
     $result = $db->CacheExecute(7200, "SELECT name, value FROM {$db->prefix}languages WHERE name=? AND language=?;", array($langvar, $lang));
     db_op_result($db, $result, __LINE__, __FILE__);
     if ($result && !$result->EOF) {
         $row = $result->fields;
         return $row['value'];
     }
 }
예제 #12
0
function distribute_toll($db, $sector, $toll, $total_fighters)
{
    $result3 = $db->Execute("SELECT * FROM {$db->prefix}sector_defence WHERE sector_id=? AND defence_type ='F'", array($sector));
    db_op_result($db, $result3, __LINE__, __FILE__);
    // Put the defence information into the array "defenceinfo"
    if ($result3 > 0) {
        while (!$result3->EOF) {
            $row = $result3->fields;
            $toll_amount = ROUND($row['quantity'] / $total_fighters * $toll);
            $resa = $db->Execute("UPDATE {$db->prefix}ships SET credits=credits + ? WHERE ship_id = ?", array($toll_amount, $row['ship_id']));
            db_op_result($db, $resa, __LINE__, __FILE__);
            playerlog($db, $row['ship_id'], LOG_TOLL_RECV, "{$toll_amount}|{$sector}");
            $result3->MoveNext();
        }
    }
}
예제 #13
0
function cancel_bounty($db, $bounty_on)
{
    $res = $db->Execute("SELECT * FROM {$db->prefix}bounty,{$db->prefix}ships WHERE bounty_on = ? AND bounty_on = ship_id", array($bounty_on));
    db_op_result($db, $res, __LINE__, __FILE__);
    if ($res) {
        while (!$res->EOF) {
            $bountydetails = $res->fields;
            if ($bountydetails['placed_by'] != 0) {
                $update = $db->Execute("UPDATE {$db->prefix}ships SET credits = credits + ? WHERE ship_id = ?", array($bountydetails['amount'], $bountydetails['placed_by']));
                db_op_result($db, $update, __LINE__, __FILE__);
                playerlog($db, $bountydetails['placed_by'], LOG_BOUNTY_CANCELLED, "{$bountydetails['amount']}|{$bountydetails['character_name']}");
            }
            $delete = $db->Execute("DELETE FROM {$db->prefix}bounty WHERE bounty_id = ?", array($bountydetails['bounty_id']));
            db_op_result($db, $delete, __LINE__, __FILE__);
            $res->MoveNext();
        }
    }
}
예제 #14
0
function defence_vs_defence($db, $ship_id)
{
    global $l;
    $result1 = $db->Execute("SELECT * FROM {$db->prefix}sector_defence WHERE ship_id = ?;", array($ship_id));
    db_op_result($db, $result1, __LINE__, __FILE__);
    if ($result1 instanceof ADORecordSet) {
        while (!$result1->EOF) {
            $row = $result1->fields;
            $deftype = $row['defence_type'] == 'F' ? 'Fighters' : 'Mines';
            $qty = $row['quantity'];
            $result2 = $db->Execute("SELECT * FROM {$db->prefix}sector_defence WHERE sector_id = ? AND ship_id <> ? ORDER BY quantity DESC", array($row['sector_id'], $ship_id));
            db_op_result($db, $result2, __LINE__, __FILE__);
            if ($result2 instanceof ADORecordSet) {
                while (!$result2->EOF && $qty > 0) {
                    $cur = $result2->fields;
                    $targetdeftype = $cur['defence_type'] == 'F' ? $l->get('l_fighters') : $l->get('l_mines');
                    if ($qty > $cur['quantity']) {
                        $resa = $db->Execute("DELETE FROM {$db->prefix}sector_defence WHERE defence_id = ?", array($cur['defence_id']));
                        db_op_result($db, $resa, __LINE__, __FILE__);
                        $qty -= $cur['quantity'];
                        $resb = $db->Execute("UPDATE {$db->prefix}sector_defence SET quantity = ? WHERE defence_id = ?", array($qty, $row['defence_id']));
                        db_op_result($db, $resb, __LINE__, __FILE__);
                        playerlog($db, $cur['ship_id'], LOG_DEFS_DESTROYED, $cur['quantity'] . "|" . $targetdeftype . "|" . $row['sector_id']);
                        playerlog($db, $row['ship_id'], LOG_DEFS_DESTROYED, $cur['quantity'] . "|" . $deftype . "|" . $row['sector_id']);
                    } else {
                        $resc = $db->Execute("DELETE FROM {$db->prefix}sector_defence WHERE defence_id = ?", array($row['defence_id']));
                        db_op_result($db, $resc, __LINE__, __FILE__);
                        $resd = $db->Execute("UPDATE {$db->prefix}sector_defence SET quantity=quantity - ? WHERE defence_id = ?", array($qty, $cur['defence_id']));
                        db_op_result($db, $resd, __LINE__, __FILE__);
                        playerlog($db, $cur['ship_id'], LOG_DEFS_DESTROYED, $qty . "|" . $targetdeftype . "|" . $row['sector_id']);
                        playerlog($db, $row['ship_id'], LOG_DEFS_DESTROYED, $qty . "|" . $deftype . "|" . $row['sector_id']);
                        $qty = 0;
                    }
                    $result2->MoveNext();
                }
            }
            $result1->MoveNext();
        }
        $rese = $db->Execute("DELETE FROM {$db->prefix}sector_defence WHERE quantity <= 0");
        db_op_result($db, $rese, __LINE__, __FILE__);
    }
}
예제 #15
0
function is_loan_pending($db, $ship_id)
{
    global $IGB_lrate;
    $res = $db->Execute("SELECT loan, UNIX_TIMESTAMP(loantime) AS time FROM {$db->prefix}ibank_accounts WHERE ship_id=?", array($ship_id));
    db_op_result($db, $res, __LINE__, __FILE__);
    if ($res) {
        $account = $res->fields;
        if ($account['loan'] == 0) {
            return false;
        }
        $curtime = time();
        $difftime = ($curtime - $account['time']) / 60;
        if ($difftime > $IGB_lrate) {
            return true;
        } else {
            return false;
        }
    } else {
        return false;
    }
}
예제 #16
0
function load_languages($db = NULL, $language = NULL, $categories = NULL, &$langvars = NULL)
{
    // Check if all supplied args are valid, if not return false.
    if (is_null($db) || is_null($language) || !is_array($categories)) {
        return false;
    }
    // Populate the $langvars array
    foreach ($categories as $category) {
        $result = $db->CacheExecute(7200, "SELECT name, value FROM {$db->prefix}languages WHERE category=? AND language=?;", array($category, $language));
        db_op_result($db, $result, __LINE__, __FILE__);
        while ($result && !$result->EOF) {
            $row = $result->fields;
            global ${$row['name']};
            ${$row['name']} = $row['value'];
            $langvars[$row['name']] = $row['value'];
            $result->MoveNext();
        }
    }
    return true;
    // Results were added into array, signal that we were successful.
}
예제 #17
0
function destroy_fighters($db, $sector, $num_fighters)
{
    $result3 = $db->Execute("SELECT * FROM {$db->prefix}sector_defence WHERE sector_id=? AND defence_type ='F' ORDER BY quantity ASC", array($sector));
    db_op_result($db, $result3, __LINE__, __FILE__);
    // Put the defence information into the array "defenceinfo"
    if ($result3 instanceof ADORecordSet) {
        while (!$result3->EOF && $num_fighters > 0) {
            $row = $result3->fields;
            if ($row['quantity'] > $num_fighters) {
                $update = $db->Execute("UPDATE {$db->prefix}sector_defence SET quantity=quantity - ? WHERE defence_id = ?", array($num_fighters, $row['defence_id']));
                db_op_result($db, $update, __LINE__, __FILE__);
                $num_fighters = 0;
            } else {
                $update = $db->Execute("DELETE FROM {$db->prefix}sector_defence WHERE defence_id = ?", array($row['defence_id']));
                db_op_result($db, $update, __LINE__, __FILE__);
                $num_fighters -= $row['quantity'];
            }
            $result3->MoveNext();
        }
    }
}
예제 #18
0
function kick_off_planet($db, $ship_id, $whichteam)
{
    $result1 = $db->Execute("SELECT * FROM {$db->prefix}planets WHERE owner = ?", array($ship_id));
    db_op_result($db, $result1, __LINE__, __FILE__);
    if ($result1 instanceof ADORecordSet) {
        while (!$result1->EOF) {
            $row = $result1->fields;
            $result2 = $db->Execute("SELECT * FROM {$db->prefix}ships WHERE on_planet = 'Y' AND planet_id = ? AND ship_id <> ?", array($row['planet_id'], $ship_id));
            db_op_result($db, $result2, __LINE__, __FILE__);
            if ($result2 instanceof ADORecordSet) {
                while (!$result2->EOF) {
                    $cur = $result2->fields;
                    $resa = $db->Execute("UPDATE {$db->prefix}ships SET on_planet = 'N',planet_id = '0' WHERE ship_id=?", array($cur['ship_id']));
                    db_op_result($db, $resa, __LINE__, __FILE__);
                    playerlog($db, $cur['ship_id'], LOG_PLANET_EJECT, $cur['sector'] . "|" . $row['character_name']);
                    $result2->MoveNext();
                }
            }
            $result1->MoveNext();
        }
    }
}
예제 #19
0
     $hex_tribes->MoveNext();
 }
 // Get allies that can be transferred to  must be in the same hex or its unfair with the above limitation
 if ($op != "tribe") {
     $allies = $db->Execute("SELECT offerer_id, receipt_id FROM {$dbtables['alliances']} WHERE accept = 'Y' AND (offerer_id = '{$clanid}' OR receipt_id = '{$clanid}')");
     db_op_result($allies, __LINE__, __FILE__);
     $i = 0;
     $allies_selectable = array();
     while (!$allies->EOF) {
         if ($allies->fields['offerer_id'] != $clanid) {
             $ally = $allies->fields['offerer_id'];
         } else {
             $ally = $allies->fields['receipt_id'];
         }
         $local_allies = $db->Execute("SELECT tribeid FROM {$dbtables['tribes']} WHERE clanid = '{$ally}' AND hex_id='{$from_hex}' ORDER BY tribeid ");
         db_op_result($local_allies, __LINE__, __FILE__);
         while (!$local_allies->EOF) {
             $allies_selectable[$i] = $local_allies->fields['tribeid'];
             $local_allies->MoveNext();
             $i++;
         }
         $allies->MoveNext();
     }
     if ($i != 0) {
         echo "<OPTION VALUE=Allies>--- Allies ---</OPTION>\n";
         sort($allies_selectable);
         foreach ($allies_selectable as $ally) {
             echo "<OPTION VALUE={$ally}";
             if ($ally == $to_tribe) {
                 echo " SELECTED";
             }
}
echo "</table>\n";
if (!empty($_POST['set'])) {
    $type = $_POST['type'];
    $time = $_POST['time'];
    $interval = $_POST['interval'];
    $intval = $_POST['intval'];
    $first_part = date("Y-m-d");
    $second_part = $time . ":00";
    $lastrun = $first_part . " " . $second_part;
    if ($intval == "H") {
        $interval = $interval * 60;
    }
    $query = $db->Prepare("UPDATE {$dbtables['scheduler']} SET last_run = ?,frequency=? where type=?");
    $finis = $db->Execute($query, array($lastrun, $interval, $type));
    db_op_result($finis, __LINE__, __FILE__);
}
echo "<br><form method='post'>";
echo "Set Last Run Time to:<select name='time'>\n";
$i = 23;
while ($i >= 0) {
    if ($i < 10) {
        $p = 0;
    }
    echo "<option value='{$p}{$i}:00'>{$p}{$i}:00</option>\n";
    $i--;
}
echo "</select> Hours<br>\n";
echo "Set Interval to: <input type='text' name='interval' value='' size='3' maxlength='3'>\n";
echo "<select name='intval'><option value='H'>Hours</option><option value='M'>Minutes</option></select>\n";
echo "<br>WHERE TYPE == :<select name='type'><option value='D'>Daily</option><option value='H'>Hourly</option></select>\n";
예제 #21
0
if (!empty($_POST['submitnews'])) {
    //days, headline,article
    $input = array((int) $_POST['days'], $_POST['headline'], $_POST['article']);
    $sql = $db->Prepare("insert into {$dbtables['news']} (created,expire,headline,news) VALUES (now(),date_add(now(),interval ? day),?,?)");
    $res = $db->Execute($sql, $input);
    db_op_result($res, __LINE__, __FILE__);
}
if (!empty($_POST['delete'])) {
    $id = $_POST['newsid'];
    $sql = $db->Prepare("DELETE FROM {$dbtables['news']} WHERE id=?");
    $res = $db->Execute($sql, array($id));
    db_op_result($res, __LINE__, __FILE__);
}
echo "<div align='left'><br><form action='' method='post'>EXPIRES IN: <input type='text' name='days' value='' size=2 maxlength=2> Days<br><br>";
echo "Headline:<input type='text' name='headline' value='' size='60'><br><br>Article:<textarea name='article' rows=5 cols=50></textarea><br>";
echo "<input type='submit' name='submitnews' value='Submit News'></form>";
echo "</div>";
echo "<table border=1 width='100%'><tr>";
echo "<th> Delete</th><th>Created</th><th>Expires</th><th>Article</th></tr>";
$sql = "SELECT * from {$dbtables['news']} order by expire";
$logs = $db->Execute($sql);
db_op_result($logs, __LINE__, __FILE__);
while (!$logs->EOF) {
    $row = $logs->fields;
    echo "<tr><td>";
    echo "<form action='' method='post'><input type='hidden' name='newsid' value='{$row['id']}'><input type='submit' name='delete' value='Delete'></form>";
    echo "</td><td>{$row['created']}</td><td>{$row['expire']}</td><td width='400'><strong>{$row['headline']}</strong><br>{$row['news']}</td></tr>";
    $logs->MoveNext();
}
echo "</table><br><a href='admin.php'>RETURN TO ADMIN</a><br>";
page_footer();
예제 #22
0
    } else {
        echo "{$tgarinfo['horse_armor']}";
    }
    echo "</TD>";
    echo "<TD>" . "<FORM METHOD=POST ACTION=garrisons.php>" . "<INPUT TYPE=HIDDEN NAME=disband VALUE=\"{$tgarinfo['garid']}\">" . "<INPUT TYPE=SUBMIT VALUE=\"Disband\">" . "</FORM>" . "</TD>" . "</TR>";
    $tgar->MoveNext();
}
echo "</TABLE><P>";
if (isset($tgarinfo['FORCE'])) {
    echo "<P><B>ADMIN WARNING</B>" . "<BR>Your game's database tables are incorrectly installed!" . "<BR>In the table <I>garrisons</I>, please rename the field <I>FORCE</I> to <I>force</i>." . "<BR>If you fail to do so, combat will not work in your game.";
}
// DISPLAY LIST OF GARRISONS IN OTHER TRIBES OF CLAN
echo "<TABLE BODER=0 ALIGN=CENTER WIDTH=80%><TR bgcolor={$color_header}><TD colspan=11>";
echo "<CENTER>Other assembled garrisons defending your clan.</CENTER></TD></TR>";
$cgar = $db->Execute("SELECT * FROM {$dbtables['garrisons']} " . "WHERE tribeid <> '" . $_SESSION['current_unit'] . "' AND " . "clanid = '" . $_SESSION['clanid'] . "' " . "ORDER BY `force`");
db_op_result($cgar, __LINE__, __FILE__);
echo "<TR bgcolor={$color_header}>" . "<TD>Tribe</TD>" . "<TD>Force Size</TD>" . "<TD>Horses</TD>" . "<TD>Experience</TD>" . "<TD>Primary Weapon</TD>" . "<TD>Secondary Weapon</TD>" . "<TD>Head Armor</TD>" . "<TD>Body Armor</TD>" . "<TD>Leg Armor</TD>" . "<TD>Shield</TD>" . "<TD>Horse Armor</TD>" . "</TR>";
$linecolor = $color_line2;
if ($cgar->EOF) {
    echo "<TR bgcolor={$linecolor}><TD COLSPAN=12><CENTER>None</CENTER></TD></TR></TABLE>";
}
while (!$cgar->EOF) {
    if ($linecolor == $color_line1) {
        $linecolor = $color_line2;
    } else {
        $linecolor = $color_line1;
    }
    $cgarinfo = $cgar->fields;
    // WARNING: The following line is a quick fix for the fact that `force` is a reserved word
    //          in later versions of MySQL and as a result the field name is sometimes returned
    //          as FORCE instead of force.
예제 #23
0
function xenobetoplanet($planet_id)
{
    // Xenobe planet attack code
    global $playerinfo, $planetinfo, $torp_dmg_rate, $level_factor;
    global $rating_combat_factor, $upgrade_cost, $upgrade_factor, $sector_max, $xenobeisdead, $db;
    $resh = $db->Execute("LOCK TABLES {$db->prefix}ships WRITE, {$db->prefix}universe WRITE, {$db->prefix}planets WRITE, {$db->prefix}news WRITE, {$db->prefix}logs WRITE");
    db_op_result($db, $resh, __LINE__, __FILE__);
    $resultp = $db->Execute("SELECT * FROM {$db->prefix}planets WHERE planet_id=?", array($planet_id));
    // Get target planet information
    db_op_result($db, $resultp, __LINE__, __FILE__);
    $planetinfo = $resultp->fields;
    $resulto = $db->Execute("SELECT * FROM {$db->prefix}ships WHERE ship_id=?", array($planetinfo['owner']));
    // Get target player information
    db_op_result($db, $resulto, __LINE__, __FILE__);
    $ownerinfo = $resulto->fields;
    $base_factor = $planetinfo['base'] == 'Y' ? $basedefense : 0;
    // Planet beams
    $targetbeams = NUM_BEAMS($ownerinfo['beams'] + $base_factor);
    if ($targetbeams > $planetinfo['energy']) {
        $targetbeams = $planetinfo['energy'];
    }
    $planetinfo['energy'] -= $targetbeams;
    // Planet shields
    $targetshields = NUM_SHIELDS($ownerinfo['shields'] + $base_factor);
    if ($targetshields > $planetinfo['energy']) {
        $targetshields = $planetinfo['energy'];
    }
    $planetinfo['energy'] -= $targetshields;
    // Planet torps
    $torp_launchers = round(pow($level_factor, $ownerinfo['torp_launchers'] + $base_factor)) * 10;
    $torps = $planetinfo['torps'];
    $targettorps = $torp_launchers;
    if ($torp_launchers > $torps) {
        $targettorps = $torps;
    }
    $planetinfo['torps'] -= $targettorps;
    $targettorpdmg = $torp_dmg_rate * $targettorps;
    // Planet fighters
    $targetfighters = $planetinfo['fighters'];
    // Attacker beams
    $attackerbeams = NUM_BEAMS($playerinfo['beams']);
    if ($attackerbeams > $playerinfo['ship_energy']) {
        $attackerbeams = $playerinfo['ship_energy'];
    }
    $playerinfo['ship_energy'] -= $attackerbeams;
    // Attacker shields
    $attackershields = NUM_SHIELDS($playerinfo['shields']);
    if ($attackershields > $playerinfo['ship_energy']) {
        $attackershields = $playerinfo['ship_energy'];
    }
    $playerinfo['ship_energy'] -= $attackershields;
    // Attacker torps
    $attackertorps = round(pow($level_factor, $playerinfo['torp_launchers'])) * 2;
    if ($attackertorps > $playerinfo['torps']) {
        $attackertorps = $playerinfo['torps'];
    }
    $playerinfo['torps'] -= $attackertorps;
    $attackertorpdamage = $torp_dmg_rate * $attackertorps;
    // Attacker fighters
    $attackerfighters = $playerinfo['ship_fighters'];
    // Attacker armor
    $attackerarmor = $playerinfo['armor_pts'];
    // Begin combat
    if ($attackerbeams > 0 && $targetfighters > 0) {
        if ($attackerbeams > $targetfighters) {
            $lost = $targetfighters;
            $targetfighters = 0;
            // Target loses all fighters
            $attackerbeams = $attackerbeams - $lost;
            // Attacker loses beams equal to Target fighters
        } else {
            $targetfighters = $targetfighters - $attackerbeams;
            // Target loses fighters equal to attacker beams
            $attackerbeams = 0;
            // Attacker loses all beams
        }
    }
    if ($attackerfighters > 0 && $targetbeams > 0) {
        if ($targetbeams > round($attackerfighters / 2)) {
            $lost = $attackerfighters - round($attackerfighters / 2);
            // Attacker loses half of all fighters
            $attackerfighters = $attackerfighters - $lost;
            $targetbeams = $targetbeams - $lost;
            // Target loses beams equal to half of attackers fighters
        } else {
            // Target beams are less than half of attackers fighters
            $attackerfighters = $attackerfighters - $targetbeams;
            // Attacker loses fighters equal to target beams
            $targetbeams = 0;
            // Target loses all beams
        }
    }
    if ($attackerbeams > 0) {
        if ($attackerbeams > $targetshields) {
            $attackerbeams = $attackerbeams - $targetshields;
            // Attacker loses beams equal to target shields
            $targetshields = 0;
            // Target loses all shields
        } else {
            $targetshields = $targetshields - $attackerbeams;
            // Target loses shields equal to attacker beams
            $attackerbeams = 0;
            // Attacker loses all beams
        }
    }
    if ($targetbeams > 0) {
        if ($targetbeams > $attackershields) {
            $targetbeams = $targetbeams - $attackershields;
            // Target loses beams equal to attacker shields
            $attackershields = 0;
            // Attacker loses all shields
        } else {
            $attackershields = $attackershields - $targetbeams;
            // Attacker loses sheilds equal to target beams
            $targetbeams = 0;
            // Target loses all beams
        }
    }
    if ($targetbeams > 0) {
        if ($targetbeams > $attackerarmor) {
            $targetbeams = $targetbeams - $attackerarmor;
            // Target loses beams equal to attacker armor
            $attackerarmor = 0;
            // Attacker loses all armor (attacker destroyed)
        } else {
            $attackerarmor = $attackerarmor - $targetbeams;
            // Attacker loses armor equal to target beams
            $targetbeams = 0;
            // Target loses all beams
        }
    }
    if ($targetfighters > 0 && $attackertorpdamage > 0) {
        if ($attackertorpdamage > $targetfighters) {
            $lost = $targetfighters;
            $targetfighters = 0;
            // Target loses all fighters
            $attackertorpdamage = $attackertorpdamage - $lost;
            // Attacker loses fired torpedoes equal to target fighters
        } else {
            $targetfighters = $targetfighters - $attackertorpdamage;
            // Target loses fighters equal to attacker torpedoes fired
            $attackertorpdamage = 0;
            // Attacker loses all torpedoes fired
        }
    }
    if ($attackerfighters > 0 && $targettorpdmg > 0) {
        if ($targettorpdmg > round($attackerfighters / 2)) {
            $lost = $attackerfighters - round($attackerfighters / 2);
            $attackerfighters = $attackerfighters - $lost;
            // Attacker loses half of all fighters
            $targettorpdmg = $targettorpdmg - $lost;
            // Target loses fired torpedoes equal to half of attacker fighters
        } else {
            // Target fired torpedoes less than or equal to half of attacker fighters
            $attackerfighters = $attackerfighters - $targettorpdmg;
            // Attacker loses fighters equal to target torpedoes fired
            $targettorpdmg = 0;
            // Tartget loses all torpedoes fired
        }
    }
    if ($targettorpdmg > 0) {
        if ($targettorpdmg > $attackerarmor) {
            $targettorpdmg = $targettorpdmg - $attackerarmor;
            // Target loses fired torpedoes equal to attacker armor
            $attackerarmor = 0;
            // Attacker loses all armor (Attacker destroyed)
        } else {
            // Target fired torpedoes less than or equal to half attacker armor
            $attackerarmor = $attackerarmor - $targettorpdmg;
            // Attacker loses armor equal to the target torpedoes fired
            $targettorpdmg = 0;
            // Target loses all torpedoes fired
        }
    }
    if ($attackerfighters > 0 && $targetfighters > 0) {
        if ($attackerfighters > $targetfighters) {
            $temptargfighters = 0;
            // Target will lose all fighters
        } else {
            // Attackers fighters less than or equal to target fighters
            $temptargfighters = $targetfighters - $attackerfighters;
            // Target will loose fighters equal to attacker fighters
        }
        if ($targetfighters > $attackerfighters) {
            // Target fighters greater than attackers fighters
            $tempplayfighters = 0;
            // Attackerwill loose ALL fighters
        } else {
            // Target fighters less than or equal to attackers fighters
            $tempplayfighters = $attackerfighters - $targetfighters;
            // Attacker will loose fighters equal to target fighters
        }
        $attackerfighters = $tempplayfighters;
        $targetfighters = $temptargfighters;
    }
    if ($targetfighters > 0) {
        if ($targetfighters > $attackerarmor) {
            // Target fighters greater than attackers armor
            $attackerarmor = 0;
            // attacker loses all armor (attacker destroyed)
        } else {
            // Target fighters less than or equal to attackers armor
            $attackerarmor = $attackerarmor - $targetfighters;
            // attacker loses armor equal to target fighters
        }
    }
    // Fix negative values
    if ($attackerfighters < 0) {
        $attackerfighters = 0;
    }
    if ($attackertorps < 0) {
        $attackertorps = 0;
    }
    if ($attackershields < 0) {
        $attackershields = 0;
    }
    if ($attackerbeams < 0) {
        $attackerbeams = 0;
    }
    if ($attackerarmor < 0) {
        $attackerarmor = 0;
    }
    if ($targetfighters < 0) {
        $targetfighters = 0;
    }
    if ($targettorps < 0) {
        $targettorps = 0;
    }
    if ($targetshields < 0) {
        $targetshields = 0;
    }
    if ($targetbeams < 0) {
        $targetbeams = 0;
    }
    if (!$attackerarmor > 0) {
        playerlog($db, $playerinfo['ship_id'], LOG_RAW, "Ship destroyed by planetary defenses on planet {$planetinfo['name']}");
        db_kill_player($playerinfo['ship_id']);
        $xenobeisdead = 1;
        $free_ore = round($playerinfo['ship_ore'] / 2);
        $free_organics = round($playerinfo['ship_organics'] / 2);
        $free_goods = round($playerinfo['ship_goods'] / 2);
        $ship_value = $upgrade_cost * (round(pow($upgrade_factor, $playerinfo['hull'])) + round(pow($upgrade_factor, $playerinfo['engines'])) + round(pow($upgrade_factor, $playerinfo['power'])) + round(pow($upgrade_factor, $playerinfo['computer'])) + round(pow($upgrade_factor, $playerinfo['sensors'])) + round(pow($upgrade_factor, $playerinfo['beams'])) + round(pow($upgrade_factor, $playerinfo['torp_launchers'])) + round(pow($upgrade_factor, $playerinfo['shields'])) + round(pow($upgrade_factor, $playerinfo['armor'])) + round(pow($upgrade_factor, $playerinfo['cloak'])));
        $ship_salvage_rate = mt_rand(10, 20);
        $ship_salvage = $ship_value * $ship_salvage_rate / 100;
        $fighters_lost = $planetinfo['fighters'] - $targetfighters;
        // Log attack to planet owner
        playerlog($db, $planetinfo['owner'], LOG_PLANET_NOT_DEFEATED, "{$planetinfo['name']}|{$playerinfo['sector']}|Xenobe {$playerinfo['character_name']}|{$free_ore}|{$free_organics}|{$free_goods}|{$ship_salvage_rate}|{$ship_salvage}");
        // Update planet
        $resi = $db->Execute("UPDATE {$db->prefix}planets SET energy=?, fighters=fighters-?, torps=torps-?, ore=ore+?, goods=goods+?, organics=organics+?, credits=credits+? WHERE planet_id=?", array($planetinfo['energy'], $fighters_lost, $targettorps, $free_ore, $free_goods, $free_organics, $ship_salvage, $planetinfo['planet_id']));
        db_op_result($db, $resi, __LINE__, __FILE__);
    } else {
        $armor_lost = $playerinfo['armor_pts'] - $attackerarmor;
        $fighters_lost = $playerinfo['ship_fighters'] - $attackerfighters;
        $target_fighters_lost = $planetinfo['ship_fighters'] - $targetfighters;
        playerlog($db, $playerinfo['ship_id'], LOG_RAW, "Made it past defenses on planet {$planetinfo['name']}");
        // Update attackers
        $resj = $db->Execute("UPDATE {$db->prefix}ships SET ship_energy=?, ship_fighters=ship_fighters-?, torps=torps-?, armor_pts=armor_pts-? WHERE ship_id=?", array($playerinfo['ship_energy'], $fighters_lost, $attackertorps, $armor_lost, $playerinfo['ship_id']));
        db_op_result($db, $resj, __LINE__, __FILE__);
        $playerinfo['ship_fighters'] = $attackerfighters;
        $playerinfo['torps'] = $attackertorps;
        $playerinfo['armor_pts'] = $attackerarmor;
        // Update planet
        $resk = $db->Execute("UPDATE {$db->prefix}planets SET energy=?, fighters=?, torps=torps-? WHERE planet_id=?", array($planetinfo['energy'], $targetfighters, $targettorps, $planetinfo['planet_id']));
        db_op_result($db, $resk, __LINE__, __FILE__);
        $planetinfo['fighters'] = $targetfighters;
        $planetinfo['torps'] = $targettorps;
        // Now we must attack all ships on the planet one by one
        $resultps = $db->Execute("SELECT ship_id,ship_name FROM {$db->prefix}ships WHERE planet_id=? AND on_planet='Y'", array($planetinfo['planet_id']));
        db_op_result($db, $resultps, __LINE__, __FILE__);
        $shipsonplanet = $resultps->RecordCount();
        if ($shipsonplanet > 0) {
            while (!$resultps->EOF && $xenobeisdead < 1) {
                $onplanet = $resultps->fields;
                xenobetoship($onplanet['ship_id']);
                $resultps->MoveNext();
            }
        }
        $resultps = $db->Execute("SELECT ship_id,ship_name FROM {$db->prefix}ships WHERE planet_id=? AND on_planet='Y'", array($planetinfo['planet_id']));
        db_op_result($db, $resultps, __LINE__, __FILE__);
        $shipsonplanet = $resultps->RecordCount();
        if ($shipsonplanet == 0 && $xenobeisdead < 1) {
            // Must have killed all ships on the planet
            playerlog($db, $playerinfo['ship_id'], LOG_RAW, "Defeated all ships on planet {$planetinfo['name']}");
            // Log attack to planet owner
            playerlog($db, $planetinfo['owner'], LOG_PLANET_DEFEATED, "{$planetinfo['name']}|{$playerinfo['sector']}|{$playerinfo['character_name']}");
            // Update planet
            $resl = $db->Execute("UPDATE {$db->prefix}planets SET fighters=0, torps=0, base='N', owner=0, corp=0 WHERE planet_id=?", array($planetinfo['planet_id']));
            db_op_result($db, $resl, __LINE__, __FILE__);
            calc_ownership($planetinfo['sector_id']);
        } else {
            // Must have died trying
            playerlog($db, $playerinfo['ship_id'], LOG_RAW, "We were KILLED by ships defending planet {$planetinfo['name']}");
            // Log attack to planet owner
            playerlog($db, $planetinfo['owner'], LOG_PLANET_NOT_DEFEATED, "{$planetinfo['name']}|{$playerinfo['sector']}|Xenobe {$playerinfo['character_name']}|0|0|0|0|0");
            // No salvage for planet because it went to the ship that won
        }
    }
    $resx = $db->Execute("UNLOCK TABLES");
    db_op_result($db, $resx, __LINE__, __FILE__);
}
예제 #24
0
        echo "{$l_notenough_cargo}  <a href=planet.php?planet_id={$planet_id}>{$l_clickme}</a> {$l_toplanetmenu}<br><br>";
    } elseif ($trade_energy > $free_power) {
        echo "{$l_notenough_power} <a href=planet.php?planet_id={$planet_id}>{$l_clickme}</a> {$l_toplanetmenu}<br><br>";
    } elseif ($playerinfo['turns'] < 1) {
        echo "{$l_notenough_turns}<br><br>";
    } elseif ($playerinfo['credits'] < $total_cost) {
        echo "{$l_notenough_credits}<br><br>";
    } elseif ($trade_organics > $planetinfo['organics']) {
        echo "{$l_exceed_organics}  ";
    } elseif ($trade_ore > $planetinfo['ore']) {
        echo "{$l_exceed_ore}  ";
    } elseif ($trade_goods > $planetinfo['goods']) {
        echo "{$l_exceed_goods}  ";
    } elseif ($trade_energy > $planetinfo['energy']) {
        echo "{$l_exceed_energy}  ";
    } else {
        echo "{$l_totalcost}: {$total_cost}<br>{$l_traded_ore}: {$trade_ore}<br>{$l_traded_organics}: {$trade_organics}<br>{$l_traded_goods}: {$trade_goods}<br>{$l_traded_energy}: {$trade_energy}<br><br>";
        // Update ship cargo, credits and turns
        $trade_result = $db->Execute("UPDATE {$db->prefix}ships SET turns=turns-1, turns_used=turns_used+1, credits=credits-{$total_cost}, ship_ore=ship_ore+{$trade_ore}, ship_organics=ship_organics+{$trade_organics}, ship_goods=ship_goods+{$trade_goods}, ship_energy=ship_energy+{$trade_energy} WHERE ship_id={$playerinfo['ship_id']}");
        db_op_result($db, $trade_result, __LINE__, __FILE__, $db_logging);
        $trade_result2 = $db->Execute("UPDATE {$db->prefix}planets SET ore=ore-{$trade_ore}, organics=organics-{$trade_organics}, goods=goods-{$trade_goods}, energy=energy-{$trade_energy}, credits=credits+{$total_cost} WHERE planet_id={$planet_id}");
        db_op_result($db, $trade_result2, __LINE__, __FILE__, $db_logging);
        echo "{$l_trade_complete}<br><br>";
    }
}
gen_score($planetinfo['owner']);
TEXT_GOTOMAIN();
?>
</div></div>
<?php 
include "footer.php";
예제 #25
0
    db_op_result($query, __LINE__, __FILE__);
    $query = $db->Execute("INSERT INTO {$dbtables['skills']} VALUES('','san','Sanitation','c','{$tribeid}','0','')");
    db_op_result($query, __LINE__, __FILE__);
    $query = $db->Execute("INSERT INTO {$dbtables['skills']} VALUES('','seek','Seeking','c','{$tribeid}','0','')");
    db_op_result($query, __LINE__, __FILE__);
    $query = $db->Execute("INSERT INTO {$dbtables['skills']} VALUES('','shb','Shipbuilding','c','{$tribeid}','0','')");
    db_op_result($query, __LINE__, __FILE__);
    $query = $db->Execute("INSERT INTO {$dbtables['skills']} VALUES('','stn','Stonework','c','{$tribeid}','0','')");
    db_op_result($query, __LINE__, __FILE__);
    $query = $db->Execute("INSERT INTO {$dbtables['skills']} VALUES('','glss','Glasswork','c','{$tribeid}','0','')");
    db_op_result($query, __LINE__, __FILE__);
    $query = $db->Execute("INSERT INTO {$dbtables['skills']} VALUES('','fctl','Fire Control','c','{$tribeid}','0','')");
    db_op_result($query, __LINE__, __FILE__);
    ///////////////////////////////////////////////////////end skills///////////////////////////////////////////////
    ///////////////////////////////////////////////////////begin mapping////////////////////////////////////////////
    $query = $db->Execute("ALTER TABLE {$dbtables['mapping']} ADD clanid_{$tribeid} smallint(2) DEFAULT '0' NOT NULL");
    db_op_result($query, __LINE__, __FILE__);
    $query = $query = $db->Execute("UPDATE {$dbtables['mapping']} SET clanid_{$tribeid} = '1' WHERE hex_id = '{$curr_hex}'");
    db_op_result($query, __LINE__, __FILE__);
    include "weight.php";
    ///////////////////////////////////////////////////////end mapping//////////////////////////////////////////////
    if ($display_password) {
        echo "Your password is " . $makepass . "<BR><BR>";
    }
    echo "Password has been sent to {$username}.<BR><BR><BR>";
}
if ($flag == 0 && $link_forums == $game_url . $game_url_path . "forums/") {
    echo "<FORM METHOD=POST ACTION={$link_forums}/profile.php TARGET=_blank>" . "<INPUT TYPE=HIDDEN NAME=mode VALUE=register>" . "<INPUT TYPE=HIDDEN NAME=agreed VALUE=true>" . "<INPUT TYPE=HIDDEN NAME=coppa VALUE=0>" . "<INPUT TYPE=HIDDEN NAME=username VALUE={$username}>" . "<INPUT TYPE=HIDDEN NAME=new_password VALUE={$makepass}>" . "<INPUT TYPE=HIDDEN NAME=password_confirm VALUE={$makepass}>" . "<INPUT TYPE=HIDDEN NAME=email VALUE={$email}>" . "<INPUT TYPE=HIDDEN NAME=submit VALUE=Submit>" . "<INPUT TYPE=SUBMIT VALUE=\"Register Automatically on Forum\">" . "</FORM>" . "<P><B>Note:</B> The forum registration page will pop up and close again." . "<BR>It may do that so quickly that you do not see its content." . "<BR>However, your forum login should be created automatically" . "<BR>with the same <i>Name</i> and <i>Password</i> as your Tribe login." . "<P>You will be sent emails confirming the creation of both your Tribe" . "<BR>Strive account and, if your click the button above, your Tribe" . "<BR>Strive Forum account." . "<P>Trying to get automatic forum registration is a new feature." . "<BR>If it does not work, please register manually using the Forum link" . "<BR>and let us know that there is a problem.";
}
echo "<P>Click <A HREF=index.php>here</A> to go to the login screen.";
page_footer();
예제 #26
0
                    $result2 = $db->Execute("UPDATE {$db->prefix}ships SET armor_pts=armor_pts-?, ship_energy=0, dev_minedeflector=0 WHERE ship_id=?;", array($mines_left, $playerinfo['ship_id']));
                    db_op_result($db, $result2, __LINE__, __FILE__, $db_logging);
                    if ($playerinfo['armor_pts'] == $mines_left) {
                        echo $l_chm_yourhullisbreached . "<br>";
                    }
                } else {
                    // BOOM
                    $pod = $playerinfo['dev_escapepod'];
                    playerlog($db, $playerinfo['ship_id'], LOG_SHIP_DESTROYED_MINES, "{$sector}|{$pod}");
                    $l_chm_hewasdestroyedbyyourmines = str_replace("[chm_playerinfo_character_name]", $playerinfo['character_name'], $l_chm_hewasdestroyedbyyourmines);
                    $l_chm_hewasdestroyedbyyourmines = str_replace("[chm_sector]", $sector, $l_chm_hewasdestroyedbyyourmines);
                    message_defence_owner($db, $sector, $l_chm_hewasdestroyedbyyourmines);
                    echo $l_chm_yourshiphasbeendestroyed . "<br><br>";
                    // Survival
                    if ($playerinfo['dev_escapepod'] == "Y") {
                        $rating = round($playerinfo['rating'] / 2);
                        echo $l_chm_luckescapepod . "<br><br>";
                        $resx = $db->Execute("UPDATE {$db->prefix}ships SET hull=0, engines=0, power=0, sensors=0, computer=0, beams=0, torp_launchers=0, torps=0, armor=0, armor_pts=100, cloak=0, shields=0, sector=0, ship_organics=0, ship_ore=0, ship_goods=0, ship_energy=?, ship_colonists=0, ship_fighters=100, dev_warpedit=0, dev_genesis=0, dev_beacon=0, dev_emerwarp=0, dev_escapepod='N', dev_fuelscoop='N', dev_minedeflector=0, on_planet='N', rating=?, cleared_defences=' ', dev_lssd='N' WHERE ship_id=?;", array($start_energy, $rating, $playerinfo['ship_id']));
                        db_op_result($db, $resx, __LINE__, __FILE__, $db_logging);
                        cancel_bounty($db, $playerinfo['ship_id']);
                    } else {
                        // Or die!
                        cancel_bounty($db, $playerinfo['ship_id']);
                        db_kill_player($playerinfo['ship_id']);
                    }
                }
            }
        }
        explode_mines($db, $sector, $roll);
    }
}
예제 #27
0
    } else {
        $db->Execute("UPDATE {$dbtables['map_view']} " . "SET times = times + 1 " . "WHERE clanid = '{$_SESSION['clanid']}'");
    }
} else {
    $db->Execute("INSERT INTO {$dbtables['map_view']} " . "VALUES('{$_SESSION['clanid']}','1')");
}
$result = $db->Execute("SELECT hex_id, res_type, terrain FROM {$dbtables['hexes']} " . "ORDER BY hex_id ASC");
db_op_result($result, __LINE__, __FILE__);
$row = $result->fields;
echo '<TABLE border=0 cellpadding=0 bgcolor=black>';
while (!$result->EOF) {
    $i = 0;
    while ($i < 64) {
        $clanmap = "clanid_" . $_SESSION['clanid'];
        $here = $db->Execute("SELECT * FROM {$dbtables['mapping']} " . "WHERE hex_id = {$row['hex_id']} " . "AND `{$clanmap}` > '0'");
        db_op_result($here, __LINE__, __FILE__);
        $hereres = $here->fields;
        if (!$here->EOF) {
            if ($hereres[$clanmap] != '1') {
                $port = $row['terrain'] . $row['res_type'];
            } else {
                $port = $row['terrain'];
            }
            $alt = $row['hex_id'];
            $tile = "<TD><img src=images/{$port}.png title={$alt} border=0></TD>";
        } else {
            $tile = '<TD><IMG SRC=images/unknown.png></TD>';
        }
        echo $tile;
        $result->Movenext();
        $row = $result->fields;
예제 #28
0
    }
    if ($allowed_rsw == "Y") {
        if ($beacon_text == "") {
            if ($sectorinfo['beacon'] != "") {
                echo $l_beacon_reads . ": " . $sectorinfo['beacon'] . "<br><br>";
            } else {
                echo $l_beacon_none . "<br><br>";
            }
            echo "<form action=beacon.php method=post>";
            echo "<table>";
            echo "<tr><td>" . $l_beacon_enter . ":</td><td><input type=text name=beacon_text size=40 maxlength=80></td></tr>";
            echo "</table>";
            echo "<input type=submit value=" . $l_submit . "><input type=reset value=" . $l_reset . ">";
            echo "</form>";
        } else {
            $beacon_text = trim(strip_tags($beacon_text));
            echo $l_beacon_nowreads . ": " . $beacon_text . ".<br><br>";
            $update = $db->Execute("UPDATE {$db->prefix}universe SET beacon=? WHERE sector_id=?", array($beacon_text, $sectorinfo['sector_id']));
            db_op_result($db, $update, __LINE__, __FILE__, $db_logging);
            $update = $db->Execute("UPDATE {$db->prefix}ships SET dev_beacon=dev_beacon-1 WHERE ship_id=?", array($playerinfo['ship_id']));
            db_op_result($db, $update, __LINE__, __FILE__, $db_logging);
        }
    }
} else {
    echo $l_beacon_donthave . "<br><br>";
}
TEXT_GOTOMAIN();
?>
</div></div>
<?php 
include "footer.php";
예제 #29
0
        $language = $_POST['language'];
        $code = $_POST['code'];
        $_SESSION['pref_language'] = $language;
        include_once "languages/{$language}/login.inc.php";
        $arr = array($_POST['username'], md5($_POST['password']));
        $sql = $db->Prepare("SELECT validation_code FROM {$db_prefix}players WHERE username=? AND password=?");
        $query = $db->Execute($sql, $arr);
        db_op_result($query, __LINE__, __FILE__);
        $result = $query->fields;
        if ($result['validation_code'] != $_POST['code']) {
            $errors[$i] = $MSG_LANG_LOGIN['invalid'];
            $i++;
        } else {
            $sql = $db->Prepare("UPDATE {$db_prefix}players SET active='1',validation_code='' WHERE username=? AND password=?");
            $res = $db->Execute($sql, $arr);
            db_op_result($res, __LINE__, __FILE__);
            $smarty->assign('success', $MSG_LANG_LOGIN['confirmed']);
            $smarty->assign('redirect', $MSG_LANG_LOGIN['redirect']);
            $smarty->display('default/confirmed.tpl');
            exit;
        }
    }
} else {
    $language = "english";
    include_once "languages/{$language}/login.inc.php";
}
$language_array = array();
if ($handle = opendir('languages')) {
    while (false !== ($file = readdir($handle))) {
        if (strpos($file, "CVS") === FALSE && $file != "." && $file != "..") {
            array_push($language_array, $file);
예제 #30
0
function xenobehunter()
{
    // Setup general Variables
    global $playerinfo, $targetlink, $xenobeisdead, $db;
    $rescount = $db->Execute("SELECT COUNT(*) AS num_players FROM {$db->prefix}ships WHERE ship_destroyed='N' AND email NOT LIKE '%@xenobe' AND ship_id > 1");
    db_op_result($db, $rescount, __LINE__, __FILE__);
    $rowcount = $rescount->fields;
    $topnum = min(10, $rowcount['num_players']);
    // If we have killed all the players in the game then stop here.
    if ($topnum < 1) {
        return;
    }
    $res = $db->Execute("SELECT * FROM {$db->prefix}ships WHERE ship_destroyed='N' AND email NOT LIKE '%@xenobe' AND ship_id > 1 ORDER BY score DESC LIMIT ?", array($topnum));
    db_op_result($db, $res, __LINE__, __FILE__);
    // Choose a target from the top player list
    $i = 1;
    $targetnum = mt_rand(1, $topnum);
    while (!$res->EOF) {
        if ($i == $targetnum) {
            $targetinfo = $res->fields;
        }
        $i++;
        $res->MoveNext();
    }
    // Make sure we have a target
    if (!$targetinfo) {
        playerlog($db, $playerinfo[ship_id], LOG_RAW, "Hunt Failed: No Target ");
        return;
    }
    // Jump to target sector
    $sectres = $db->Execute("SELECT sector_id, zone_id FROM {$db->prefix}universe WHERE sector_id=?", array($targetinfo['sector']));
    db_op_result($db, $sectres, __LINE__, __FILE__);
    $sectrow = $sectres->fields;
    $zoneres = $db->Execute("SELECT zone_id,allow_attack FROM {$db->prefix}zones WHERE zone_id=?", array($sectrow['zone_id']));
    db_op_result($db, $zoneres, __LINE__, __FILE__);
    $zonerow = $zoneres->fields;
    // Only travel there if we can attack in the target sector
    if ($zonerow['allow_attack'] == "Y") {
        $stamp = date("Y-m-d H-i-s");
        $move_result = $db->Execute("UPDATE {$db->prefix}ships SET last_login=?, turns_used=turns_used+1, sector=? WHERE ship_id=?", array($stamp, $targetinfo['sector'], $playerinfo['ship_id']));
        db_op_result($db, $move_result, __LINE__, __FILE__);
        playerlog($db, $playerinfo[ship_id], LOG_RAW, "Xenobe used a wormhole to warp to sector {$targetinfo['sector']} where he is hunting player {$targetinfo['character_name']}.");
        if (!$move_result) {
            $error = $db->ErrorMsg();
            playerlog($db, $playerinfo[ship_id], LOG_RAW, "Move failed with error: {$error} ");
            return;
        }
        // Check for sector defences
        $resultf = $db->Execute("SELECT * FROM {$db->prefix}sector_defence WHERE sector_id=? AND defence_type ='F' ORDER BY quantity DESC", array($targetinfo['sector']));
        db_op_result($db, $resultf, __LINE__, __FILE__);
        $i = 0;
        $total_sector_fighters = 0;
        if ($resultf > 0) {
            while (!$resultf->EOF) {
                $defences[$i] = $resultf->fields;
                $total_sector_fighters += $defences[$i]['quantity'];
                $i++;
                $resultf->MoveNext();
            }
        }
        $resultm = $db->Execute("SELECT * FROM {$db->prefix}sector_defence WHERE sector_id=? AND defence_type ='M'", array($targetinfo['sector']));
        db_op_result($db, $resultm, __LINE__, __FILE__);
        $i = 0;
        $total_sector_mines = 0;
        if ($resultm > 0) {
            while (!$resultm->EOF) {
                $defences[$i] = $resultm->fields;
                $total_sector_mines += $defences[$i]['quantity'];
                $i++;
                $resultm->MoveNext();
            }
        }
        if ($total_sector_fighters > 0 || $total_sector_mines > 0 || $total_sector_fighters > 0 && $total_sector_mines > 0) {
            // Attack sector defences
            $targetlink = $targetinfo['sector'];
            xenobetosecdef();
        }
        if ($xenobeisdead > 0) {
            return;
            // Sector defenses killed the Xenobe
        }
        playerlog($db, $playerinfo[ship_id], LOG_RAW, "Xenobe launching an attack on {$targetinfo['character_name']}.");
        // Attack the target
        if ($targetinfo['planet_id'] > 0) {
            xenobetoplanet($targetinfo['planet_id']);
            // Yes, so move to that planet
        } else {
            xenobetoship($targetinfo['ship_id']);
            // Not on a planet, so move to the ship
        }
    } else {
        playerlog($db, $playerinfo[ship_id], LOG_RAW, "Xenobe hunt failed, target {$targetinfo['character_name']} was in a no attack zone (sector {$targetinfo['sector']}).");
    }
}