Exemple #1
0
function mysql_die($string)
{
    $error_txt = sprintf($st[1120], $string) . mysql_errno() . $st[1121] . mysql_error();
    fix_table();
    write_to_error_log($error_txt);
}
Exemple #2
0
                    $dest_id = 1;
                    $extra_txt = mysql_escape_string("Message to <b class='b1'>All Admins</b> from <font color='lime'>The Server Operator</font>:<p /> " . $text);
                } else {
                    $dest_id = -1;
                    $extra_txt = mysql_escape_string("Message to <b class='b1'>All Game Forums</b> from <font color='lime'>The Server Operator</font>:<p /> " . $text);
                }
                dbn("insert into {$dest['db_name']}_messages (timestamp,sender_name, sender_id, login_id, text) values(" . time() . ",'{$user['login_name']}','{$user['login_id']}','{$dest_id}','{$extra_txt}')");
            }
        }
    }
    //empty the error log.
} elseif (isset($_REQUEST['empty_log'])) {
    if (!isset($_POST['sure'])) {
        get_var('Erase log', "developer.php", "Are you Sure you want to erase the error log?", 'sure', 'yes');
    } else {
        write_to_error_log("", "", 1);
    }
    //empty the error log.
} elseif (isset($_GET['show_log'])) {
    $results = load_xml("{$directories['games']}/{$log_name}", 1);
    $header_str = "";
    $content_str = "";
    $b_link = "<br /><br /><a href='#top'>Top</a><br />";
    //loop through the entries
    foreach ($results as $key => $content_array) {
        //contains the time of last emptying.
        if (isset($content_array[$key]['last_emptied'])) {
            $header_str = "<a name='top'>Last Emptied: <b>" . $content_array[$key]['last_emptied'] . "</b></a> - <a href='{$_SERVER['PHP_SELF']}?empty_log=1'>Empty Now</a><p />\n";
            //must be an error report then
        } else {
            //state username is undefined if none was taken.
Exemple #3
0
         $t_bonus['num_pc'] += $target_ships[$ship_id]['num_pc'];
         $t_bonus['num_ew'] += $target_ships[$ship_id]['num_ew'];
         if (config_check("po", $target_ships[$ship_id])) {
             $po_ship_figs_foes += $target_ships[$ship_id]['fighters'];
         } elseif (config_check("so", $target_ships[$ship_id])) {
             $po_ship_figs_foes += $target_ships[$ship_id]['fighters'];
         }
     }
 }
 //end foreach for ships dumping ships into groups
 //remember how many fighters had in each group at start of combat. This copy is used for fig kills calculations.
 $user_fighters = $user_group['fighters'];
 $target_fighters = $target_group['fighters'];
 //make sure neither side has 0 ships.
 if ($target_group['ship_count'] == 0 && $target_group['planets'] == 0 || $user_group['ship_count'] == 0) {
     write_to_error_log(sprintf($st[281], $target_group[ship_count], $user_group[ship_count], $gen_tactic_to_use));
 }
 //work out the averages of stuff
 $user_group['speed'] = average_finder($user_group['speed'], $user_group['ship_count']);
 if ($planet_attack == 0) {
     $target_group['speed'] = average_finder($target_group['speed'], $target_group['ship_count']);
     $target_group['size'] = average_finder($target_group['size'], $target_group['ship_count']);
     $target_group['exp'] = average_finder($target_group['exp'], $target_group['ship_count']);
 } else {
     $target_group['speed'] = 0;
     $target_group['size'] = 0;
     $target_group['exp'] = 0;
 }
 $user_group['size'] = average_finder($user_group['size'], $user_group['ship_count']);
 $user_group['exp'] = average_finder($user_group['exp'], $user_group['ship_count']);
 //update bonus's.
<?php

header("Content-type: text/xml");
print "<?xml version='1.0' encoding=\"ISO-8859-1\" ?>\r\n<main>\n";
$login_id = $_GET['login_id'];
$game = $_GET['game'];
if ($login_id && $login_id != 'undefined' && $game) {
    include "games/config.dat.php";
    include "includes/{$game}" . "_vars.inc.php";
    $midx = $GAME_VARS['uv_size_x_width'] / 2;
    $midy = $GAME_VARS['uv_size_y_height'] / 2;
    $database_link = @mysql_connect(DATABASE_HOST, DATABASE_USER, DATABASE_PASSWORD) or write_to_error_log("No connection to the Database could be created.<p />The following error was reported:<br /><b>" . mysql_error() . "</b>");
    mysql_select_db(DATABASE, $database_link) or mysql_die("");
    $resultat = mysql_query("select explored_sys, location from {$game}" . "_users where login_id={$login_id}");
    $user = mysql_fetch_array($resultat);
    $etoiles = explode(',', $user['explored_sys']);
    foreach ($etoiles as $etoile) {
        $resultat2 = mysql_query("select * from {$game}" . "_stars where star_id={$etoile}");
        $origine = mysql_fetch_array($resultat2);
        for ($i = 1; $i <= 7; $i++) {
            $type_lien = '';
            if ($origine['link_' . $i]) {
                // lien normal
                $resultat3 = mysql_query("select * from {$game}" . "_stars where star_id=" . $origine['link_' . $i]);
                $destination = mysql_fetch_array($resultat3);
                $type_lien = "normal";
            } elseif ($i == 7 && $origine['wormhole']) {
                // lien wormhole
                $resultat3 = mysql_query("select * from {$game}" . "_stars where star_id=" . $origine['wormhole']);
                $destination = mysql_fetch_array($resultat3);
                if ($origine['star_id'] == $destination['wormhole']) {
Exemple #5
0
******************/
//close db link
if (!empty($database_link)) {
    mysql_close($database_link);
}
$final_str .= "\n\n\n<p><hr>Maintenance Cycle Ending";
$end_time = explode(" ", microtime());
$end_time = $end_time[1] + $end_time[0];
$total_time = $end_time - $start_time;
$final_str .= "\n<br />Total Time take : {$total_time}<hr>";
$final_str .= "\n-------------------------------------------------------------------";
$output_store = ob_get_contents();
ob_end_clean();
//only write the log if something happened, and not directly requesting.
if (!empty($output_store) && empty($_GET['dir_req'])) {
    write_to_error_log($output_store . $final_str, "", -1);
}
//user wants to see the results.
if (!empty($_GET['dir_req'])) {
    echo $output_store . $final_str;
    //if not requesting direct output, see if required to make logs
} elseif ($make_logs_of_maints == 1) {
    if (extension_loaded("zlib")) {
        $ext = ".gz";
        $comp = true;
    } else {
        //unable to compress
        $ext = ".html";
        $comp = false;
    }
    //open the file for outputting