Esempio n. 1
0
function get_data($sql, $db = NULL)
{
    if ($db == NULL) {
        if (c('on_sae')) {
            $db = db2();
        } else {
            $db = db();
        }
    }
    $GLOBALS['LZ_LAST_SQL'] = $sql;
    $data = array();
    $i = 0;
    $result = mysql_query($sql, $db);
    if (mysql_errno() != 0) {
        echo mysql_error() . ' ' . $sql;
    }
    while ($Array = mysql_fetch_array($result, MYSQL_ASSOC)) {
        $data[$i++] = $Array;
    }
    if (mysql_errno() != 0) {
        echo mysql_error() . ' ' . $sql;
    }
    mysql_free_result($result);
    if (count($data) > 0) {
        return $data;
    } else {
        return false;
    }
}
Esempio n. 2
0
function create_tracking_table($substatus, $textstat)
{
    global $status, $login_id;
    $action = "";
    $issue['id'] = "Bug ID";
    $issue['title'] = "Bug Title";
    $issue['status'] = "Status";
    $issue['login_id'] = "Submitted By";
    $issue['action'] = "Action(s)";
    $out = make_table($issue, "WIDTH=55%");
    $counter = 0;
    db("SELECT id, title, login_id FROM server_issuetracking WHERE status= " . $status . $substatus);
    while ($issues = dbr(1)) {
        $action = "<a href='{$_SERVER['PHP_SELF']}?status={$status}&id={$issues['id']}&action=view'>View</a>";
        if ($login_id == OWNER_ID) {
            //server admin only
            if ($status == 1) {
                $action .= " - <a href='{$_SERVER['PHP_SELF']}?&status={$status}&id={$issues['id']}&action=forward'>Outstanding</a>";
                $action .= " - <a href='{$_SERVER['PHP_SELF']}?&status={$status}&id={$issues['id']}&action=resolve'>Close</a>";
            } elseif ($status == 2) {
                $action .= " - <a href='{$_SERVER['PHP_SELF']}?&status={$status}&id={$issues['id']}&action=forward'>Close</a>";
                $action .= " - <a href='{$_SERVER['PHP_SELF']}?&status={$status}&id={$issues['id']}&action=up'>Up</a>";
                $action .= " - <a href='{$_SERVER['PHP_SELF']}?&status={$status}&id={$issues['id']}&action=down'>Down</a>";
            } elseif ($status == 3) {
                $action .= " - <a href='{$_SERVER['PHP_SELF']}?&status={$status}&id={$issues['id']}&action=reopen'>Reopen</a>";
                $action .= " - <a href='{$_SERVER['PHP_SELF']}?&status={$status}&id={$issues['id']}&action=up'>Up</a>";
                $action .= " - <a href='{$_SERVER['PHP_SELF']}?&status={$status}&id={$issues['id']}&action=down'>Down</a>";
            }
        }
        //end of admin only.
        $issue['id'] = $issues['id'];
        $issue['title'] = $issues['title'];
        $issue['status'] = $textstat;
        db2("select login_name from user_accounts where login_id = '{$issues['login_id']}'");
        $temp_store = dbr2(1);
        $issue['login_id'] = $temp_store['login_name'];
        $issue['action'] = $action;
        $out .= make_row($issue);
        $counter++;
    }
    if ($counter == 0) {
        //if no bugs
        $issue['id'] = "NONE";
        $issue['title'] = "";
        $issue['status'] = "";
        $issue['login_id'] = "";
        $issue['action'] = "";
        $out .= make_row($issue);
    }
    $out .= "</table>";
    return " - {$counter} Entries<br />" . $out;
}
Esempio n. 3
0
     $order_by_sql = "flost";
 } elseif ($ranking == 6) {
     $order_by_str = $cw['ships_killed'];
     $order_by_sql = "skilled";
 } elseif ($ranking == 7) {
     $order_by_str = $cw['ships_lost'];
     $order_by_sql = "slost";
 } elseif ($ranking == 8) {
     $order_by_str = $cw['turns_run'];
     $order_by_sql = "trun";
 } else {
     $order_by_str = $cw['score'];
     $order_by_sql = "score";
 }
 #get details of each clan
 db2("select c.clan_id,c.clan_name,c.symbol,c.sym_color, count(u.login_id) as members, sum(u.fighters_killed) as fkilled, sum(u.fighters_lost) as flost, sum(u.ships_killed) as skilled, sum(u.ships_lost) as slost, sum(u.turns_run) as trun, sum(u.score) as score from {$db_name}_clans c, {$db_name}_users u where u.clan_id = c.clan_id && u.login_id > 5 GROUP by c.clan_id order by {$order_by_sql} {$order_dir}");
 $clan = dbr2(1);
 $error_str .= sprintf($st[546], $clan_count[0], $GAME_VARS[clans_max], $order_by_str);
 $error_str .= make_table(array($cw['rank'], "<a href={$filename}?ranking=2" . $dir_array[2] . ">" . $cw['clan_name'] . "</a>", "<a href={$filename}?ranking=3" . $dir_array[3] . ">" . $cw['members'] . "</a>", "<a href={$filename}?ranking=4" . $dir_array[4] . ">" . $cw['fighters'] . "<br />" . $cw['killed'] . "</a>", "<a href={$filename}?ranking=5" . $dir_array[5] . ">" . $cw['fighters'] . "<br />" . $cw['lost'] . "</a>", "<a href={$filename}?ranking=6" . $dir_array[6] . ">" . $cw['ships'] . "<br />" . $cw['killed'] . "</a>", "<a href={$filename}?ranking=7" . $dir_array[7] . ">" . $cw['ships'] . "<br />" . $cw['lost'] . "</a>", "<a href={$filename}?ranking=8" . $dir_array[8] . ">" . $cw['turns'] . "<br />" . $cw['run'] . "</a>", "<a href={$filename}?ranking=1" . $dir_array[1] . ">" . $cw['score'] . "</a>"));
 $ct1 = 1;
 $ct2 = 1;
 $last = "";
 while ($clan) {
     if (isset($player) && $player[$order_by_sql] != $last) {
         $last = $player[$order_by_sql];
         if ($ct2 > 1) {
             $ct1 = $ct2;
         }
     }
     $option = "";
     if ($user['clan_id'] == 0 && $clan['members'] < $GAME_VARS['clan_member_limit'] || $user['login_id'] == 1) {
Esempio n. 4
0
function FPC($fil, $data = '', $A = '')
{
    #alias pour file_put_contents
    if (e('erver:pre', 1) && strpos($fil, 'tmp')) {
        e(',pre:no tmp files write');
        return;
    }
    if (preg_match("~/l/[0-9]{1,3}\\.~", $fil)) {
        FPC(ERLOGS, "\nfpc:{$fil}:" . SU, 4);
    }
    #if(preg_match("~punposts~",$fil))FPC(ERLOGS,"\nfpc:$fil:".SU,4);#est fiable !!
    #if(strpos($fil,IP)&&!preg_match('~dev/shm/|perf/|block/~',$fil)){FPC(ERLOGS,"rif:".__FILE__.Preg_replace("~\r|\n|\t| {2,}|\.{2,}~",' ',print_r(dbgt(),1))."\n",1);return;}
    #if(strpos($fil,'l2/'))Pat($fil,$data);
    static $todo, $file, $in, $i = [];
    $in++;
    #if(US=='ben')kill('--'.print_r(dbgt(),1));
    if ($fil == 'fpdata' or !$fil) {
        return;
    }
    if (j9 && strpos($fil, 'pdata/')) {
        kill(pre(db2()));
    }
    if ($fil === 2) {
        return count($todo);
    }
    #delayée#Attention à ne pas planter avant
    if ($fil == 1) {
        if ($todo) {
            foreach ($todo as $f => $v) {
                FPC($f, $v);
            }
        }
        unset($todo);
        return;
    }
    #Simple
    if ($A == 4) {
        $todo[$fil] = $data;
    }
    #regrouper et delayer les écritures on kill;
    if (!$fil) {
        Db('fpc:' . SU);
    }
    #Controleur Principal I/O
    if (strpos($fil, 'tp:/')) {
        Block('spam?k=' . $fil);
    }
    #Db("fpc:$fil via ".SU);
    if (is_Array($data)) {
        $data = json_encode($data);
    }
    #fixSer($data);
    #if(strpos(' '.$k,'tp://'))block();
    if (H == 'ben' && in_array($fil, array(L2 . 'php.db', L2 . 'debug.db'))) {
        echo "FPC2Ben host -> debug<li>{$data}";
        return;
    }
    $gt = GT("fpc{$fil}:0");
    $ti = round($gt / 1000);
    if (!strpos($fil, '557b') && preg_match('~array~i', $fil)) {
        Db("FPC:{$fil}" . SU, '', 'prio');
    }
    #Temporiser les écritures dans le fichier - Le faire en processus shutdown Génère plein de lignes de débug en trop !
    if (!preg_match('~2001|admin~i', u)) {
        if ($file == $fil) {
            if (array_key_exists($fil, $i)) {
                if ($i[$fil] > 3) {
                    Db("3times fpc :{$fil}");
                }
            }
        }
        $file = $fil;
        if ($i[$fil]) {
            $i[$fil]++;
        } else {
            $i[$fil] = 1;
        }
        #si on tente d'écrire dans le fichier précédent
    }
    #preg_match('/\.([^\.]*$)/', $this->file_src_name, $extension);
    if ((strlen($data) > 70000000 || $ti > 10) && !preg_match('~Test|admin|2001~i', u) && !preg_match("~err|debug|decalees|\\.size~", $fil) && us != 'ben') {
        $tri = 1;
        Db("{$ti} sec," . $i[$fil] . "times (FPC:{$fil})" . su2 . print_r($_ENV, 1), '', 'prio');
    }
    #recursion,strlen($data).#['dbe']['db']
    #&&$tri!=1
    if ($A == 3) {
        $f = fmkt($fil);
        file_put_contents($fil, $data);
        if (!$f) {
            $f = 1;
        }
        touch($fil, $f);
        return;
    }
    if ($A == 2) {
        FAP($fil, $data);
        return;
    }
    if (in_Array($A, array('1', 'app', 'append'))) {
        file_put_contents($fil, $data, FILE_APPEND);
        return;
    }
    File_put_contents($fil, $data);
    GT("fpc{$fil}:1");
    $x = error_get_last();
    if (strpos($x['message'], 'participation') && !strpos($x['message'], 'defined index')) {
        Dbm('error', db2());
    }
}
Esempio n. 5
0
            //(config_check("ls", $ships) || config_check("hs", $ships) && !config_check("sc", $ships))
            if ($can_attack == 0 || $ships['login_id'] == 1 || $user['clan_id'] == $ships['clan_id'] && $user['clan_id'] > 0 || $ships['turns_run'] < $GAME_VARS['turns_safe'] || (config_check("ls", $ships) || config_check("hs", $ships) && !config_check("sc", $ships)) || checkHolidayMode($ships['login_id'])) {
                $error_str .= "<br />";
            } else {
                $error_str .= " - <a href='attack.php?target={$ships['ship_id']}'>" . $cw['attack'] . "</a><br />";
            }
            $ships = dbr2(1);
        }
        #end of loop through other ships.
        unset($ships);
    } else {
        $error_str .= $st[61];
    }
    /* SHOW SUMMARY OF ENEMY SHIPS	*/
} else {
    db2("select count(s.ship_id) as total, sum(s.fighters) as fighters, s.login_id, u.clan_id, u.turns_run, s.config from {$db_name}_ships s, {$db_name}_users u where s.location = '{$user['location']}' && s.ship_id > 1 && s.login_id != '{$user['login_id']}' && u.login_id = s.login_id group by config REGEXP 'hs|ls', login_id order by total");
    $ships = dbr2(1);
    if (!$ships) {
        $error_str .= "<br />" . $st[61];
    } else {
        if ($user['login_id'] == 1 || ($user['turns_run'] < $GAME_VARS['turns_before_space_attack'] || $user['ship_id'] == 1) || $user['location'] == 1 && $GAME_VARS['attack_sol_flag'] == 0 || $GAME_VARS['attack_space_flag'] == 0) {
            $can_attack = 0;
        } else {
            $can_attack = 1;
        }
        $error_str .= "<A HREF='location.php?show_enemy_ships=1'>" . $st[62] . "</A><p />";
        $cloaked_ships = 0;
        $cloaked_figs = 0;
        $cloaked_attack_link = "";
        while ($ships) {
            !isset($ships['config']) ? $ships['config'] = "" : 1;
Esempio n. 6
0
} elseif (isset($_GET['keep'])) {
    $user_options['color_scheme'] = $_GET['keep'];
    dbn("update {$db_name}_user_options set color_scheme = '" . (int) $_GET['keep'] . "' where login_id = '{$user['login_id']}'");
    $error_str .= $st[974] . " <b>{$_GET['keep']}</b>.";
    $error_str .= "<br />" . $st[975];
    $rs .= "<br /><a href='options.php'>" . $cw['back_to_options'] . "</a>";
    print_page($st[976], $error_str);
    #keep new style sheet. for server
} elseif (isset($_GET['keep_server'])) {
    dbn("update user_accounts set default_color_scheme = '" . (int) $_GET['keep_server'] . "' where login_id = '{$user['login_id']}'");
    $error_str .= $st[977] . " <b>{$_GET['keep_server']}</b>.";
    $error_str .= "<br />" . $st[978];
    $rs .= "<br /><a href='options.php'>" . $cw['back_to_options'] . "</a>";
    print_page($st[976], $error_str);
}
#print main page
$error_str .= "<p />" . $st[979];
$error_str .= "<p /><a href='options.php?changepass=change'>" . $st[980] . "</a>";
//$error_str .= "<br /><a href='options.php?scheme=1'>Change your Colour Scheme</a>";
$error_str .= "<br /><a href='options.php?player_op=1'>" . $st[981];
if ($user['login_id'] != 1) {
    $error_str .= "<p /><a href='options.php?retire=1'>" . $st[982] . "</a>";
}
#list other options
$error_str .= "<p />" . $st[983] . ".<form method='POST' name='get_var_form' action='options.php'>";
$error_str .= "<br /><input type='submit' value=\"" . $cw['submit_vars'] . "\" />";
#select and output all the user options
db2("select * from option_list order by name asc");
$error_str .= list_options(1, $user_options);
$error_str .= "<br /><input type='hidden' name='save_vars' value='1' /><input type='submit' value=\"" . $cw['submit_vars'] . "\" /></form>";
print_page($st[984], $error_str);
Esempio n. 7
0
 //Define the object
 $graph = new PHPlot();
 $data_array = array();
 $data_array[] = "";
 $legend_array = array();
 $cheap_counter = 0;
 //select the values from the db, and put them into an array.
 db2("select login_name, {$element} from {$db} where {$element} > 0 && login_id > 5 order by {$element} desc limit {$players_selected}");
 while ($temp_store = dbr2(1)) {
     $cheap_counter += $temp_store[$element];
     $data_array[] = $temp_store[$element];
     $legend_array[] = $temp_store['login_name'];
 }
 if ($remaining == 1) {
     //include remaining players, only if wanted
     db2("select sum({$element}) as all_users from {$db} where {$element} > 0 && login_id > 5");
     $temp_store2 = dbr2(1);
     $data_array[] = $temp_store2['all_users'] - $cheap_counter;
     $legend_array[] = $cw['all_other_players'];
 }
 if (count($data_array) < 2) {
     //don't bother trying to make a graph, if no users.
     exit;
 }
 //Set some data
 if ($graph_type == 1) {
     //text-data (no time)
     $example_data = array($data_array, $data_array);
 } else {
     //data-data (any extra entries are time).
     $example_data = array($data_array);
Esempio n. 8
0
        //unset so don't end up back at the preview when clicking submit
        unset($_POST['preview'], $_POST['text']);
    }
    get_var('Send Message', 'message.php', $page_str, 'msg', $data_for_textbox);
} else {
    //done with the text
    $text = mcit($text);
}
//send messages
// if there are more than 100 characters in a line with no spaces, then complain.
if (preg_match("/\\S{100,}/", $text)) {
    print_page($cw['error'], $st[908] . " ;-)");
}
//send a message to each of the clan mates.
if ($target_id == -2) {
    db2("select login_id from {$db_name}_users where clan_id='{$clan_id}' && clan_id > 0");
    $target_member = dbr2(1);
    while ($target_member) {
        send_message($target_member['login_id'], $text);
        send_templated_email($target_member['login_id'], 'message');
        $target_member = dbr2(1);
    }
    $error_str = $st[909];
    //send message to all players in the game
} elseif ($target_id == -4) {
    $error_str = message_all_players($text, $db_name, $st[910], "<b class=\"b1\">" . $cw['admin'] . "</b>");
    //send message to clan forum
} elseif ($target_id == -5 && $clan_id > 0) {
    send_message($target_id, $text, $clan_id);
    $error_str = $cw['message_sent'] . ".";
    //send message to central forum
Esempio n. 9
0
db("select *, count(last_ip) as nb from user_accounts where login_id>5 and last_ip != '' and passwd != '' and ban=0 and login_count>0 group by last_ip, passwd having nb > 1 order by last_ip");
while ($data = dbr()) {
    $out .= $data['login_name'] . ' - ' . $data['nb'] . '<br />';
    mysql_query("update user_accounts set ban=1, raison='Multi-compte interdit' where last_ip='" . $data['last_ip'] . "' AND passwd = '" . $data['passwd'] . "' ORDER BY `signed_up` DESC LIMIT " . ($data['nb'] - 1));
    //	$out .= "<br/>update user_accounts set ban=0, raison='Multi-compte interdit' where last_ip='" . $data['last_ip'] ."' AND passwd = '" . $data['passwd'] ."' ORDER BY `signed_up` DESC LIMIT ".($data['nb'] - 1)."<br/>";
}
//Moriarty's Multi Checker
$pass_check = array();
//store for all passwords
$dup_pass = array();
//Store for duplicate passwords
$ip_check = array();
//store for all passwords
$ip_pass = array();
//Store for duplicate passwords
db2("select a.login_name,a.login_id,a.passwd,a.last_ip,a.email_address,s.login_id from user_accounts a, {$db_name}_users s where a.login_id > 5 && s.login_id = a.login_id order by last_ip");
while ($m_check = dbr2()) {
    $x_pa = $pass_check;
    //This loop finds same pass's
    while ($var = each($x_pa)) {
        if ($var['value'] == $m_check['passwd']) {
            //A duplicate password
            $dup_pass[$m_check['login_id']] = $m_check['passwd'];
            $dup_pass[$var['key']] = $var['value'];
        }
    }
    $pass_check[$m_check['login_id']] = $m_check['passwd'];
    $x_ip = $ip_check;
    //this loop finds same IP's
    if ($m_check['last_ip']) {
        while ($var = each($ip_check)) {
Esempio n. 10
0
function myErrorHandler($no = null, $msg = null, $file = null, $line = null, $plus = null)
{
    $no1 = $no;
    if (!$no) {
        #called as shutdown function
        $error = error_get_last();
        if ($error !== NULL && $error["type"] == 1) {
            $no = E_ERROR;
            $msg = $error['message'];
            $file = $error['file'];
            $line = $error['line'];
        }
    }
    static $errors;
    if ($no === 1 && $errors) {
        $s = '';
        foreach ($errors as $k => $v) {
            $s .= '-' . $k . ' ' . $v . "\n";
        }
        $errors = [];
        file_put_contents(ini_get('error_log'), $s, FILE_APPEND);
        return;
        /*records all encountered errors*/
    }
    $errorType = [E_DEPRECATED => 0, E_NOTICE => 0, E_USER_NOTICE => 0, E_STRICT => 0, E_ERROR => 'ERROR', E_WARNING => 'WARNING', E_PARSE => 'PARSING ERROR', E_CORE_ERROR => 'CORE ERROR', E_CORE_WARNING => 'CORE WARNING', E_COMPILE_ERROR => 'COMPILE ERROR', E_COMPILE_WARNING => 'COMPILE WARNING', E_USER_ERROR => 'USER ERROR', E_USER_WARNING => 'USER WARNING', E_RECOVERABLE_ERROR => 'RECOVERABLE ERROR'];
    if (array_key_exists($no, $errorType)) {
        $no = $errorType[$no];
    } else {
        $no = 'others';
    }
    #if($error){echo in_array($no,[null,'ignore']);print_r(compact('no','error','msg'));}
    if (in_array($no, [null, 'ignore'])) {
        return;
    }
    #0 matches all string
    #specials
    if (strpos($msg, 'annot redeclare')) {
        Dbm(SU . ' fun defined ' . $msg, db2());
    }
    if (!$msg) {
        return 0;
    }
    #stand error handler continues here :) $msg=SU;
    if (strpos($msg, "\n") !== false) {
        $msg = explode("\n", $msg);
        $msg = reset($msg);
    }
    #no stack trace !!
    $errors[str_replace('/z/', '', $file) . ':' . $line] = $no . ' : ' . $msg;
    #if($no=='WARNING')throw new \Exception($msg,$no1);#no catch: uncaught exception ..
    if ($no == 'ERROR') {
        #fatal, no more would be handler
        if (stripos($error['message'], 'Call to undefined function') !== false) {
            $f = 'lib/fun.map.php';
            if (!$_ENV['funmap'] && is_file($f)) {
                $_ENV['funmap'] = unserialize(file_get_contents($f));
                #tion r302 -> fun.php
            }
            if (preg_match('#function ([^\\(]+)\\(\\) #', $error['message'], $m)) {
                if (array_key_exists($m[1], $_ENV['funmap'])) {
                    $load = new $m[1]();
                    #requires autoload.php
                }
            }
        }
        myErrorHandler(1);
        ob_end_clean();
        header("HTTP/1.0 500 Internal Server Error", 1, 500);
        if (AJAX) {
            die('/*500*/');
        }
        #js or css
        echo "<html><head><title>500 error</title><style>body{background:#003;color:#AAA;}</style></head><body><table width=100% height=100% border=0 align=center><tr><td><center><h1>500 - une erreur est survenue<br>" . (is_string($m) ? $m : '') . "<br><a href='/'><img src='http://x24.fr/immologo1.png'><br>Retour a l'accueil</a></h1><br><form action='http://google.fr/search' method=get><input type=hidden name=q value='site:" . H . "'><input name=q><input type=submit value=rechercher></form></td></tr></table>" . $f . "</body></html>";
        die;
        return 1;
    }
    return compact('msg', 'file', 'line');
    #for try catch block
}
Esempio n. 11
0
function mail_ood_users()
{
    global $db_name, $final_str, $cw, $st;
    //get galaxy name
    db2("select name from se_games where db_name='{$db_name}' LIMIT 1");
    $galaxy_name = dbr2(1);
    $galaxy_name = $galaxy_name['name'];
    //select users who have been inactive in a game for a while.
    $time = time() - 7 * 86400;
    $q = "select {$db_name}_users.login_id, {$db_name}_users.login_name,\r\n\tuser_accounts.last_reminder,\r\n\tuser_accounts.email_address\r\n\tfrom {$db_name}_users\r\n\tleft join user_accounts on {$db_name}_users.login_id = user_accounts.login_id\r\n\twhere {$db_name}_users.login_id > 5\r\n\t&& {$db_name}_users.joined_game < '{$time}'\r\n\t&& {$db_name}_users.last_request < '{$time}'\r\n\t&& ({$db_name}_users.banned_time < " . time() . " || {$db_name}_users.banned_time = 0)\r\n\t&& user_accounts.last_reminder = 0\r\n\t";
    db($q);
    //	echo 'a ajuns';
    //	var_dump($q);
    while ($users = dbr(1)) {
        //		echo 'a intrat';
        if (filter_var($users['email_address'], FILTER_VALIDATE_EMAIL)) {
            $contactname = $users['login_name'];
            $contactemail = $users['email_address'];
            include '../includes/email_templates/days7.php';
            $message = str_replace(array("{nickname}", "{galaxy_name}"), array($contactname, $galaxy_name), $message);
            //the line bellow is for testing only
            //$contactemail = '*****@*****.**';
            $headers = "MIME-Version: 1.0\n";
            $headers .= "Content-type: text/plain; charset=iso-8859-1\n";
            $headers .= "X-Priority: 1\n";
            $headers .= "X-MSMail-Priority: High\n";
            $headers .= "X-Mailer: php\n";
            $headers .= "From: \"" . SERVER_NAME . "\" <*****@*****.**>\n";
            mail("\"" . $contactname . "\" <" . $contactemail . ">", $subject, $message, $headers);
            dbn("update user_accounts set last_reminder = '" . time() . "' where login_id = '{$users['login_id']}'");
            $final_str .= "\n<br />{$users['login_name']} Reminded through email";
        }
    }
}
Esempio n. 12
0
    } else {
        $text .= $st[151];
    }
    $text .= $st[160];
} else {
    if ($num_ent[0] < $max) {
        $text .= "<p /><br /><a href='{$filename}?add=1'>" . $cw['add_entry'] . "</a>";
    } else {
        $text .= $st[161];
    }
    $text .= $st[162];
    $text .= make_table(array($cw['date_entered'], $cw['entry']));
    if ($num_ent[0] > 1) {
        $text .= "<FORM method=POST action=diary.php name=quick_del><input type=hidden name=del_select value=1 />";
    }
    db2("select * from {$db_name}_diary where login_id = '{$user['login_id']}' order by timestamp desc");
    while ($entry = dbr2(1)) {
        //list entries
        $entry['entry'] = stripslashes($entry['entry']);
        $entry['entry'] = mcit($entry['entry']);
        $e_num = $entry['entry_id'];
        $entry['entry_id'] = "- <a href='{$filename}?edit={$e_num}'>" . $cw['edit'] . "</a> - <a href='{$filename}?delete={$e_num}'>" . $cw['delete'] . "</a>";
        if ($num_ent[0] > 1) {
            $entry['entry_id'] .= "- <input type=checkbox name=del_ent[{$e_num}] value={$e_num} />";
        }
        $text .= make_row(array("<b>" . date("M d - H:i", $entry['timestamp']) . "</b>", $entry['entry'], $entry['entry_id']));
    }
    $text .= "</table><br />";
}
if ($num_ent[0] > 1) {
    //show the big delete options
Esempio n. 13
0
function calc_values()
{
    global $db_name, $final_str, $GAME_VARS, $mining_drone_cost, $research_fac_cost, $st, $cw;
    //work out the value of all extra equip.
    //delta bomb costs MINIMUM of 15 regular bombs
    db2("select sum(cash + (genesis * {$GAME_VARS['cost_genesis_device']}) + ((alpha + gamma + (delta * 15)) * {$GAME_VARS['bomb_cost']})) as value, login_id from {$db_name}_users group by login_id");
    //loop through all players
    while ($p_val = dbr2(1)) {
        $t_value = $p_val['value'];
        $l_id = $p_val['login_id'];
        //work out value of ships
        db("select sum(s.cost + (u.fighters * {$GAME_VARS['fighter_cost_earth']}) + (u.metal * {$GAME_VARS['buy_metal']}) + (u.fuel * {$GAME_VARS['buy_fuel']}) + (u.elect * {$GAME_VARS['buy_elect']}) + (u.colon * {$GAME_VARS['cost_colonist']})) as value from {$db_name}_ships u, se_ship_types s where u.login_id = '{$l_id}' && u.shipclass = s.type_id");
        $temp = dbr(1);
        $t_value += $temp['value'];
        //value of planets
        db("select sum(cash + (fighters * {$GAME_VARS['fighter_cost_earth']}) + (metal * {$GAME_VARS['buy_metal']}) + (fuel * {$GAME_VARS['buy_fuel']}) + (elect * {$GAME_VARS['buy_elect']}) + (colon * {$GAME_VARS['cost_colonist']}) + (research_fac * {$research_fac_cost}) + (mining_drones * {$mining_drone_cost})) as value from {$db_name}_planets where login_id = '{$l_id}'");
        $temp = dbr(1);
        $t_value += $temp['value'];
        dbn("update {$db_name}_users set approx_value = '{$t_value}' where login_id = '{$p_val['login_id']}'");
    }
}
Esempio n. 14
0
     $enc_oldpass = md5($oldpass);
     $enc_newpass = md5($newpass);
 }
 if (!empty($newpass) && $newpass == $newpass2) {
     if (strlen($newpass) < 5) {
         //ensure length
         $temp_str = $st[952] . "<br />";
     } elseif ($newpass == $oldpass) {
         //make sure it's not the same as the old one.
         $temp_str = $st[953];
     } elseif ($user['login_name'] == $newpass) {
         //using login name as pass
         $temp_str = $st[954];
     } elseif ($enc_oldpass == $p_user['passwd']) {
         if ($user['login_id'] == 1) {
             db2("update se_games set admin_pw='" . mysql_escape_string($newpass) . "' where db_name = '" . $db_name . "'");
             $temp_str .= $st[955];
             $p_user['passwd'] = '$newpass';
         } else {
             db("update user_accounts set passwd='{$enc_newpass}' where login_id='" . $login_id . "'");
             $p_user['passwd'] = $enc_newpass;
         }
         $temp_str = $st[956];
         $donnees['type'] = 'message_succes';
         insert_history($user['login_id'], $st[957]);
     } else {
         $temp_str = $st[958] . "!";
     }
 } else {
     $temp_str = $st[959] . "";
     //$temp_str .= "<a href='javascript:back()'>".$cw['go_back']."</a><br />";
Esempio n. 15
0
function get_cost($lookup)
{
    db2("select cost, tech_cost from se_config_list where config_id = '{$lookup}'");
    return dbr2(1);
}
Esempio n. 16
0
function black_hole($user, $star)
{
    global $db_name, $user_ship;
    $bh_text = "Attention ! Attention ! Un trou noir a été détecté dans le systéme <b{$star['star_id']}</b>.<br />Vous manquez de peu d'être aspiré dedans mais vous parvenez à vous échapper au dernier moment. Vous prenez la fuite mais votre flotte à été dispersée dans la galaxie !";
    db("select count(star_id) from {$db_name}_stars");
    $total1 = dbr();
    $total = $total1[0];
    if ($user_ship['ship_id']) {
        $n_text = "";
        db2("select ship_id,shields,fighters,ship_name from {$db_name}_ships where fleet_id = '{$user_ship['fleet_id']}' and location = '{$user_ship['location']}' && login_id = '{$user['login_id']}'");
        while ($tow_ship = dbr2()) {
            $rand_star = random_system_num();
            dbn("update {$db_name}_ships set location = '{$rand_star}', mine_mode=0 where ship_id = {$tow_ship['ship_id']}");
            $totaldefs = $tow_ship['shields'] + $tow_ship['fighters'];
            if ($totaldefs > 9) {
                $damtodo = round($totaldefs / 100 * 5);
                $damtodo2 = $damtodo;
                $shield_damage = $damtodo;
                if ($shield_damage > $tow_ship['shields']) {
                    $shield_damage = $tow_ship['shields'];
                }
                $damtodo -= $shield_damage;
                dbn("update {$db_name}_ships set fighters = fighters - {$damtodo}, shields = shields - {$shield_damage} where ship_id = '{$tow_ship['ship_id']}'");
                $n_text .= "<br />The <b class=b1>{$tow_ship['ship_name']}</b> took <b>{$damtodo2}</b> damage and was thrown to system #<b>{$rand_star}</b>.";
            }
        }
        $rand_star = mt_rand(2, $total);
        if ($star['star_id'] == $rand_star) {
            if ($rand_star != $total) {
                $rand_star++;
            } else {
                $rand_star = $rand_star - 1;
            }
        }
        dbn("update {$db_name}_ships set location = {$rand_star}, mine_mode=0 where ship_id = {$user_ship['ship_id']}");
        $totaldefs = $user_ship['shields'] + $user_ship['fighters'];
        if ($totaldefs > 9) {
            $damtodo = round($totaldefs / 100 * 5);
            $damtodo2 = $damtodo;
            $shield_damage = $damtodo;
            if ($shield_damage > $user_ship['shields']) {
                $shield_damage = $user_ship['shields'];
            }
            $damtodo -= $shield_damage;
            dbn("update {$db_name}_ships set fighters = fighters - {$damtodo}, shields = shields - {$shield_damage} where ship_id = '{$user_ship['ship_id']}'");
            $m_text .= "<p />The <b class=b1>{$user_ship['ship_name']}</b> took <b>{$damtodo2}</b> damage and was thrown to system #<b>{$rand_star}</b>.";
            $user_ship['shields'] -= $shield_damage;
            $user_ship['fighters'] -= $damtodo;
        }
        $bh_text .= $m_text;
        if (!empty($n_text)) {
            $bh_text .= "<p />Reports from the rest of the Fleet Follow:<br />";
            $bh_text .= $n_text;
        }
        $tow_ship = $user_ship;
        dbn("update {$db_name}_users set location = {$rand_star} where login_id = '{$user['login_id']}'");
        dbn("update {$db_name}_ships set location = {$rand_star} where ship_id = '{$user['ship_id']}'");
    }
    post_news("Mayday, Mayday. Ici le capitaine <b class=b1>{$user['login_name']}</b>. Nous avons rencontré un trou noir...... *crackle* ..... besoin d'aide.... *static*", "random_event, ship");
    print_page("Location", $bh_text);
}
Esempio n. 17
0
                $new_page .= "<input type=hidden name={$var} value='{$value}' />";
            }
            $new_page .= "<p />" . $cw['disband_clan'] . " <input type=radio name=what_to_do value=1 CHECKED /> / " . $cw['assign_new_clan_leader'] . "<input type=radio name=what_to_do value=2 /><p /><input type='submit' value='" . $cw['submit'] . "' /></form>";
            print_page($cw['retiring'], $new_page);
            #removing the clan
        } elseif ($clan['members'] < 2 || $what_to_do == 1) {
            dbn("update {$db_name}_users set clan_id = 0 where clan_id = {$clan['clan_id']}");
            dbn("update {$db_name}_planets set clan_id = -1 where clan_id = {$clan['clan_id']}");
            dbn("delete from {$db_name}_clans where clan_id = {$clan['clan_id']}");
            dbn("delete from {$db_name}_messages where clan_id = {$clan['clan_id']}");
            post_news(sprintf($st[125], $clan[clan_name], $clan[sym_color], $clan[symbol]), "clan, player_status");
        } elseif ($what_to_do == 2 && !$leader_id) {
            $new_page = $st[126];
            $new_page .= "<form action=retire.php method=POST name=retiring2>";
            #$new_page .= "<input type=hidden name=what_to_do value='$what_to_do' />";
            db2("select login_id,login_name from {$db_name}_users where clan_id = '{$clan['clan_id']}' && login_id != '{$clan['login_id']}'");
            $new_page .= "<select name=leader_id>";
            while ($member_name = dbr2(1)) {
                $new_page .= "<option value={$member_name['login_id']}>{$member_name['login_name']}</option>";
            }
            $new_page .= "</select>";
            while (list($var, $value) = each($HTTP_POST_VARS)) {
                $new_page .= "<input type=hidden name={$var} value='{$value}' />";
            }
            $new_page .= "<p /><input type='submit' value='" . $cw['submit'] . "' /></form>";
            print_page($st[127], $new_page);
        } else {
            dbn("update {$db_name}_clans set leader_id = {$leader_id} where clan_id = {$clan['clan_id']}");
        }
    }
}
Esempio n. 18
0
function scramble_explored(&$target)
{
    global $db_name, $cw, $st;
    $new_array = array();
    if ($target['explored_sys'] != -1) {
        //loop through all system explored (if not explored whole universe).
        foreach (explode(",", $target['explored_sys']) as $value) {
            //delete value if not sys 1, not present location, and randomly says so.
            if ($value == 1 || $value == $target['location'] || mt_rand(0, 6) < 4) {
                $new_array[] = $value;
            }
        }
        //user has explored whole universe, so going to have to do this the hard way. :)
    } else {
        db2("select count(star_id) from {$db_name}_stars");
        $total_num_stars = dbr2();
        //loop through all existing system
        for ($i = 1; $i <= $total_num_stars[0]; $i++) {
            //delete value if not sys 1, not present location, and randomly says so.
            if ($i == 1 || $i == $target['location'] || mt_rand(0, 6) < 4) {
                $new_array[] = $i;
            }
        }
    }
    $target['explored_sys'] = implode(",", $new_array);
    dbn("update {$db_name}_users set explored_sys = '{$target['explored_sys']}' where login_id = '{$target['login_id']}'");
}
Esempio n. 19
0
         //Make sure all ships are given a time-stamp so as they can't be used during attacking.
         dbn("update {$db_name}_ships set ship_engaged = '{$time_to_engage}' where " . $update_ships_sql_friends);
         $updated_friends_1 = mysql_affected_rows();
     }
     //something went wrong and there were no ships to update?!?!?!
     if (empty($update_ships_sql_friends) || isset($updated_friends_1) && $updated_friends_1 < 1) {
         print_page($st[268]);
     }
 }
 /**************
 * Enemy ships into array
 **************/
 //no need to collect foes ships if attacking a planet.
 if ($planet_attack == 0) {
     //select all Enemy ships and dump them into an array.
     db2("select s.*" . $enemy_ship_counter_sql . " group by s.ship_id order by fighters {$dir_foe_ships}");
     $update_ships_sql_enemies = "";
     //loop through friendlies and put them all into a array
     while ($loop_enemies = dbr2(1)) {
         $loop_enemies['approx_damage'] = $loop_enemies['shields'] + $loop_enemies['fighters'] + $loop_enemies['armour'] * $armour_multiplier;
         $loop_enemies['ship_allocated'] = 0;
         $loop_enemies['friend_foe'] = 2;
         if ($loop_enemies['approx_damage'] < 1) {
             //ship has no damage absorb cap. So kill it outright.
             $loop_enemies['ship_destroyed'] = 1;
         } else {
             $loop_enemies['ship_destroyed'] = 0;
         }
         $target_ships[$loop_enemies['ship_id']] = $loop_enemies;
         $update_ships_sql_enemies .= "ship_id = '{$loop_enemies['ship_id']}' || ";
         $players_array[$loop_enemies['login_id']]['total_fighters'] += $loop_enemies['fighters'];
Esempio n. 20
0
    		  </form>';
    }
    */
    if (!$show_galaxies) {
        echo '<p>Vous êtes en mode vacances, pour revenir en mode normal allez au menu <a href="user_extra.php">compte & parrainage</a>.</p>';
    }
    ?>
	</div>

	<div id="accueilColonne2" style="width: 400px;">
	<?php 
    $alpha_text = "";
    $beta_text = "";
    if (!$p_user['ban'] && $show_galaxies) {
        //cycle through the games that are running.
        db2("select name, db_name, paused, game_id, days_left, description from se_games where status = '1' order by last_reset asc");
        while ($game_stat = dbr2(1)) {
            $stat = " - " . popup_help("game_info.php?db_name={$game_stat['db_name']}", 600, 450);
            if ($game_stat['paused'] == 1) {
                $stat .= " - (" . $cw['paused'] . ")";
            }
            db("select {$game_stat['db_name']}_value as value from se_db_vars where name = 'sudden_death'");
            $sd = dbr(1);
            if ($sd['value'] == 1) {
                $stat .= " - (" . $cw['sudden_death'] . ")";
            }
            db("select {$game_stat['db_name']}_value as value from se_db_vars where name = 'new_logins'");
            $sd = dbr(1);
            if ($sd['value'] == 0) {
                $stat .= " - (" . $st[810] . ")";
            }
Esempio n. 21
0
function backup_db()
{
    global $db_name, $final_str, $directories, $comp, $db_func_query;
    set_time_limit(500);
    //this could take time (get's done inside 1 sec on my comp, but servers arn't that dedicated. Plus they have more db entries. :)
    //can compress the files.
    if (extension_loaded("zlib")) {
        $ext = ".gz";
        $comp = true;
    } else {
        //unable to compress
        $ext = ".sql";
        $comp = false;
    }
    //specify, and open the file.
    $file_name = DATABASE . "_db_backup-" . date("G.i-M.d.Y") . $ext;
    $fp = fopen("../{$directories['backups']}/{$file_name}", "wb");
    $counter = 0;
    //select all tables from DB and loop through them
    db2("SHOW TABLE STATUS");
    while ($tables = dbr2(1)) {
        $counter++;
        $tab_str = "\n\nDROP TABLE IF EXISTS {$tables['Name']};\nCREATE TABLE {$tables['Name']} (";
        $col_count = 0;
        //create table structure for table
        db("SHOW COLUMNS FROM {$tables['Name']}");
        while ($cols = dbr(1)) {
            $tab_str .= "\n{$cols['Field']} {$cols['Type']} ";
            if (!isset($cols['null'])) {
                //set not null
                $tab_str .= "NOT NULL";
            } else {
                $tab_str .= "NULL";
            }
            if ($cols['Default'] != '') {
                //place default
                $tab_str .= " default '{$cols['Default']}'";
            }
            if ($cols['Extra'] == 'auto_increment') {
                //place auto incremement
                $tab_str .= " auto_increment";
            }
            $tab_str .= ",";
            //end row
            $col_count++;
        }
        //end looping through columns
        unset($cols);
        mysql_free_result($db_func_query);
        $keys_array = array();
        //work out what the keys are for the table.
        db("SHOW INDEX FROM {$tables['Name']}");
        while ($keys = dbr(1)) {
            if ($keys['Non_unique'] == 0 && $keys['Key_name'] != "PRIMARY") {
                //a unique key.
                $keys_array['UNIQUE'] = (isset($keys_array['UNIQUE']) ? $keys_array['UNIQUE'] : "") . "UNIQUE KEY {$keys['Key_name']} ({$keys['Column_name']}), ";
            } else {
                //non primary (foreign?)
                $keys_array[$keys['Key_name']] = (isset($keys_array[$keys['Key_name']]) ? $keys_array[$keys['Key_name']] : "") . "{$keys['Column_name']}, ";
            }
        }
        //end collecting key info
        unset($keys);
        mysql_free_result($db_func_query);
        //loop through the array of keys, and list the keys at the bottom
        foreach ($keys_array as $key_type => $val) {
            $tab_str .= "\n";
            if ($key_type != "UNIQUE") {
                if ($key_type != "PRIMARY") {
                    $tab_str .= "KEY ";
                } else {
                    $key_type .= " KEY";
                    //apend "key" to "primary"
                }
                $tab_str .= "{$key_type} (" . preg_replace("/, \$/", "", $val) . "),";
            } else {
                $tab_str .= $val;
            }
        }
        //end sorting out key info
        unset($keys_array);
        //remove trailing comma, and end table creation.
        $tab_str = preg_replace("/, \$/", "", $tab_str) . "\n)ENGINE={$tables['Engine']};";
        if ($comp) {
            //compress before writing
            $tab_str = gzencode($tab_str . "\n\n");
        }
        //save table structure to file now.
        fwrite($fp, $tab_str);
        fflush($fp);
        $tab_str = "";
        $ins_count = 0;
        //get the table's actual data for the inserts
        //MUST use numerical array (rather than associative)
        db("select * from {$tables['Name']}");
        while ($rows = dbr()) {
            $tab_str .= "\nINSERT INTO {$tables['Name']} VALUES (";
            $ins_count++;
            //increment row counter
            //create the values for the insert statement
            for ($i = 0; $i < $col_count; $i++) {
                $tab_str .= "'" . mysql_escape_string($rows[$i]) . "', ";
            }
            $tab_str = preg_replace("/, \$/", "", $tab_str) . ");";
            //remove trailing comma
            //every 100 rows, dump them to the file (save memory, and stops from crashing).
            //100 seems to be the optimal number.
            /*
            Do it every 1000, it takes about 5 times as long.
            do it every 10, it takes about 3 times as long.
            But 90-100 seems to be a magic number. At least one my PC.
            */
            if ($ins_count == 100) {
                if ($comp) {
                    //compress before writing
                    $tab_str = gzencode($tab_str);
                }
                //save table structure to file now.
                fwrite($fp, $tab_str);
                fflush($fp);
                $tab_str = "";
                $tab_str = "";
                //clear tab_str. otherwise might have major issues.
                $ins_count = 0;
                //reset counter
            }
        }
        unset($rows);
        mysql_free_result($db_func_query);
        if ($comp) {
            //compress before writing
            $tab_str = gzencode($tab_str . "\n\n");
        }
        //save table structure to file now.
        fwrite($fp, $tab_str);
        fflush($fp);
        $tab_str = "";
    }
    //end table loop
    //all done
    fclose($fp);
    $final_str .= "\n<br />{$counter} tables backed up to '{$file_name}'...<br />\n";
}
Esempio n. 22
0
function load_admin_vars()
{
    global $GAME_VARS, $db_name;
    $GAME_VARS = array();
    db2("select {$db_name}_value as value, name from se_db_vars");
    while ($result = dbr2(1)) {
        $GAME_VARS[$result['name']] = $result['value'];
    }
}
Esempio n. 23
0
function load_unload_planet($selected_ships, $load_or_unload, $do_ship = 0)
{
    global $user, $user_ship, $db_name, $tech_mat, $text_mat, $planet, $sure, $type, $dump_all, $cw, $st;
    discern_type($type);
    $extra_where = "";
    $captaining = 0;
    if ($selected_ships == 1) {
        foreach ($do_ship as $ship_id) {
            $extra_where .= "ship_id = '{$ship_id}' || ";
            if ($ship_id == $user['ship_id']) {
                $captaining = 1;
            }
        }
        $extra_where = preg_replace("/\\|\\| \$/", "", $extra_where);
        $extra_where = "&& ({$extra_where})";
    }
    if ($load_or_unload == 2) {
        //unloading the ship
        //select all ships that are valid
        db("select sum({$tech_mat}) as goods, count(ship_id) as ship_count from {$db_name}_ships where login_id = '{$user['login_id']}' && location = '{$user['location']}' && {$tech_mat} > 0 " . $extra_where);
        $results = dbr(1);
        $turn_cost = ceil($results['ship_count'] * 0.75);
        $max_reached = "";
        if (!isset($results['goods'])) {
            //no goods on any ships
            return sprintf($st[1535], $text_mat);
        } elseif ($user['turns'] < $turn_cost && !isset($dump_all)) {
            //insufficient turns
            return sprintf($st[1536], $turn_cost);
            unset($results);
        } elseif ($results['goods'] + $planet['colon'] > $planet['max_population'] && $type == 1) {
            $max_reached = "<b class='b1'>" . $cw['warning'] . "</b>: " . $st[1537];
        } elseif (!isset($sure) && $selected_ships == 0 && !isset($dump_all)) {
            //confirmation
            get_var($st[1538] . " {$text_mat}", 'planet.php', sprintf($st[1539], $text_mat, $results[goods], $results[ship_count], $turn_cost) . $max_reached, 'sure', 'yes');
        } else {
            //finish unloading the planets.
            $t_cost_str = "";
            dbn("update {$db_name}_planets set {$tech_mat} = {$tech_mat} + '{$results['goods']}' where planet_id = '{$user['on_planet']}'");
            dbn("update {$db_name}_ships set {$tech_mat} = 0 where login_id = '{$user['login_id']}' && location = '{$user['location']}' && {$tech_mat} > 0 " . $extra_where);
            if (!isset($dump_all)) {
                charge_turns($turn_cost);
                $t_cost_str = " pour un coût total de <b>{$turn_cost}</b> cycles.";
            }
            if ($captaining == 1 || $selected_ships == 0 && $user_ship[$tech_mat] > 0) {
                $user_ship[$tech_mat] = 0;
                empty_bays($user_ship);
            }
            $planet[$tech_mat] += $results['goods'];
            return "<b>{$results['goods']}</b> " . sprintf($st[1540], $text_mat, $results[ship_count]) . $t_cost_str;
        }
    } else {
        //loading the ship
        $taken = 0;
        //goods taken from planet so far.
        $ship_counter = 0;
        if ($planet[$tech_mat] < 1) {
            //can't take stuff if there isn't any to take
            return sprintf($st[1541], $text_mat);
        } elseif ($type == 0) {
            //fighters
            db2("select ship_id,(max_fighters - fighters) as free,ship_name, {$tech_mat} from {$db_name}_ships where login_id = '{$user['login_id']}' && location = '{$user['location']}' && (max_fighters - fighters) > 0 {$extra_where} order by free desc");
        } elseif ($type != 0) {
            db2("select ship_id, (cargo_bays - metal - fuel - elect - colon) as free, ship_name, {$tech_mat} from {$db_name}_ships where login_id = '{$user['login_id']}' && location = '{$user['location']}' && (cargo_bays - metal - fuel - elect - colon) > 0 {$extra_where} order by free desc");
        }
        $ships = dbr2(1);
        $first_mess = "";
        $sec_mess = "";
        $turns_txt = "";
        $out = "";
        if ($type == 0 && $planet['allocated_to_fleet'] > 0) {
            //warning about fighter allocation
            $first_mess = $cw['warning'] . ".<br /> " . $st[1542];
            $sec_mess = $cw['warning'] . ":<br />" . $st[1543];
        }
        if (!isset($ships['ship_id']) && $selected_ships == 0) {
            //check to see if there are any ships
            return $st[1544] . " <b class='b1'>{$text_mat}</b>.";
        } elseif (!isset($ships['ship_id']) && $selected_ships == 1) {
            //check to see if there are any ships
            return $st[1545] . " <b class='b1'>{$text_mat}</b>.";
        } else {
            while ($ships) {
                $ship_counter++;
                //planet can load ship w/ spare fighters.
                if ($ships['free'] < $planet[$tech_mat] - $taken) {
                    if (isset($sure) || $selected_ships == 1) {
                        //only run during the real thing.
                        dbn("update {$db_name}_ships set {$tech_mat} = {$tech_mat} + '{$ships['free']}' where ship_id = '{$ships['ship_id']}'");
                        $out .= "<br /><b class='b1'>{$ships['ship_name']}</b> : " . sprintf($st[1546], $ships[free], $text_mat);
                        if ($ships['ship_id'] == $user_ship['ship_id'] && $type == 0) {
                            #update user ship
                            $user_ship['fighters'] = $user_ship['max_fighters'];
                        } elseif ($ships['ship_id'] == $user_ship['ship_id'] && $type > 0) {
                            #update user ship
                            $user_ship[$tech_mat] += $ships['free'];
                            $user_ship['empty_bays'] -= $ships['free'];
                        }
                    }
                    $taken += $ships['free'];
                    //ensure user has enough turns, or stop the loop where the user is.
                    if ($user['turns'] <= ceil($ship_counter * 0.75)) {
                        $turns_txt = $st[1547];
                        $out .= $st[1548];
                        unset($ships);
                        break;
                    }
                    //planet will run out of fighters.
                } elseif ($ships['free'] >= $planet[$tech_mat] - $taken) {
                    $t868 = $ships[$tech_mat] + ($planet[$tech_mat] - $taken);
                    if (isset($sure) || $selected_ships == 1) {
                        #only run during the real thing.
                        dbn("update {$db_name}_ships set {$tech_mat} = '{$t868}' where ship_id = '{$ships['ship_id']}'");
                        $out .= "<br /><b class='b1'>{$ships['ship_name']}</b>s " . $st[1549] . " <b>{$t868}</b> <b class='b1'>{$text_mat}</b>";
                        if ($ships['ship_id'] == $user_ship['ship_id'] && $type == 0) {
                            #update user ship
                            $user_ship['fighters'] = $t868;
                        } elseif ($ships['ship_id'] == $user_ship['ship_id'] && $type > 0) {
                            #update user ship
                            $user_ship[$tech_mat] = $t868;
                            empty_bays($user_ship);
                        }
                    }
                    $taken += $t868 - $ships[$tech_mat];
                    unset($ships);
                    break;
                }
                $ships = dbr2(1);
            }
            #end loop of ships
            $turn_cost = ceil($ship_counter * 0.75);
            if (!isset($sure) && $selected_ships == 0) {
                get_var($st[1550], 'planet.php', $turns_txt . sprintf($st[1551], $ship_counter, $taken, $text_mat, $turn_cost) . "<p />" . $first_mess, 'sure', 'yes');
            } else {
                dbn("update {$db_name}_planets set {$tech_mat} = {$tech_mat} - '{$taken}' where planet_id = '{$user['on_planet']}'");
                $planet[$tech_mat] -= $taken;
                if ($planet['allocated_to_fleet'] > 0 && $type == 0) {
                    dbn("update {$db_name}_planets set allocated_to_fleet = 0 where planet_id = '{$user['on_planet']}'");
                }
                charge_turns($turn_cost);
                if ($type == 1) {
                    #colonists
                    $planet['alloc_fight'] = 0;
                    $planet['alloc_elect'] = 0;
                    dbn("update {$db_name}_planets set alloc_fight = 0, alloc_elect=0 where planet_id = '{$user['on_planet']}'");
                    $out .= $st[1552];
                }
                return "<b>{$ship_counter}</b>" . sprintf($st[1553], $taken, $text_mat) . " <b class='b1'>{$planet['planet_name']}</b>:<br />" . $out . "<p />" . $st[1554] . " <b>{$turn_cost}</b>.<p />" . $sec_mess;
            }
        }
    }
}
Esempio n. 24
0
        print_page($cw['sudden_death'], $st[735]);
    }
} elseif ($user_ship['shipclass'] < 3) {
    print_page($cw['Error'], $st[736]);
}
if (isset($do_ship)) {
    //user has selected stuff to transfer
    $num_ships = count($do_ship);
    $target_ship_count = ship_counter($target['login_id']);
    $estimated_cost = $num_ships * $cost_per_transfer;
    $loop_txt = "";
    $rs .= "<p /><a href='send_ship.php?target={$target['login_id']}'>" . $cw['tranfer_another_ship'] . "</a><br />";
    #var_dump($target_ship_count);
    db2("select * from user_accounts where login_id = '" . $target['login_id'] . "' LIMIT 1");
    $user_transferto = dbr2();
    db2("select * from user_accounts where login_id = '" . $user['login_id'] . "' LIMIT 1");
    $user_transferfrom = dbr2();
    if ($user['cash'] < $estimated_cost) {
        # ensure have enough cash
        $text .= sprintf($st[737], $estimated_cost, $estimated_cost) . $cw['credits'] . ".";
    } elseif ($num_ships < 1) {
        $text .= $st[738];
    } elseif ($target_ship_count['other_reached'] == 1 && $target_ship_count['war_reached'] == 1) {
        $text .= "<b class='b1'>{$target['login_name']}</b> " . $st[739];
    } elseif ($user_transferfrom['last_ip'] == $user_transferto['last_ip']) {
        $text .= sprintf($st[1890], $user_transferto['login_name']);
    } else {
        //can transfer ships.
        $transfer_counter = 0;
        //loops through the ships.
        foreach ($do_ship as $ship_id) {
Esempio n. 25
0
            //if it is a directory, add to the array (make sure not . or ..) so can look into it later
            if (is_dir($file) && $file != "." && $file != "..") {
                $dir_array[] = $dir_value . $file . "/";
            } elseif (is_file($file)) {
                $file_size += filesize($file);
            }
        }
        closedir($dir_stream);
    }
    $out_str .= "<p>SE File Installation size: " . number_format($file_size / 1024) . " KBytes";
    print_page("Server Details", $out_str);
    //List information about each of the games.
} elseif (isset($_GET['game_details'])) {
    $out_str .= "<p />Game Details:";
    //loop through games
    db2("select * from se_games order by name");
    while ($game = dbr2()) {
        $db_name = $game['db_name'];
        db("select count(login_id),sum(cash),sum(turns),sum(turns_run),sum(ships_killed), sum(fighters_lost) as lost_fighters, sum(fighters_killed) as killed_fighters from {$db_name}_users where login_id > 5");
        $ct = dbr();
        db("select count(login_id) from {$db_name}_users where ship_id != 1 && login_id > 5");
        $ct2 = dbr();
        db("select count(login_id),sum(fighters) from {$db_name}_ships where login_id > 5");
        $ct3 = dbr();
        db("select count(planet_id),sum(fighters),sum(colon),sum(elect),sum(metal),sum(fuel) from {$db_name}_planets where login_id != 1");
        $ct4 = dbr();
        db("select count(distinct clan_id),count(login_id) from {$db_name}_users where clan_id > 0 && login_id > 5");
        $ct5 = dbr();
        db("select count(*) from {$db_name}_news");
        $ct6 = dbr();
        db("select count(message_id) from {$db_name}_messages where login_id = -1");
Esempio n. 26
0
$out .= "<a href='multiscan.php'>Multi scan</a><br />";
$out .= "<a href='{$_SERVER['PHP_SELF']}?ban=1'>Ban Player</a><br />";
$out .= "<a href='{$_SERVER['PHP_SELF']}?update_scores=1'>Update Scores</a><br />";
$out .= "<a href='{$_SERVER['PHP_SELF']}?more_money=1'>Give Money</a><p />";
$out .= "General:<br />";
$out .= "<a href='{$_SERVER['PHP_SELF']}?admin_name=1'>Change Admin Name</a><br />";
$out .= "<a href='{$_SERVER['PHP_SELF']}?email=1'>Change Admin E-mail</a><br />";
$out .= "<a href='{$_SERVER['PHP_SELF']}?descr=1'>Change Game Description</a><br />";
$out .= "<a href='{$_SERVER['PHP_SELF']}?messag=1'>Change Intro Message</a><br />";
$out .= "<a href='{$directories['includes']}/other_admin.php?admin_readme=1'>Admin Readme!</a><br />";
$out .= "<form action='{$_SERVER['PHP_SELF']}' name='get_var_form' method='post'>";
$out .= "<input type='hidden' name='save_vars' value='1' />";
$out .= "<input type='submit' value='Submit Vars' />";
$out .= "<p />Note: Only variables that are within range will be saved.";
//load the vars that are in the DB for this. File vars may be outdated.
load_admin_vars();
db2("select name, min, max, description from se_db_vars order by name");
$out .= list_options(1, $GAME_VARS);
$db_var = dbr(1);
while ($db_var) {
    if ($db_var['value'] < $db_var['min'] || $db_var['value'] > $db_var['max']) {
        //error checking
        $db_var['value'] = $db_var['default_value'];
    }
    $out .= "<p /><table border=2 cellspacing=1 width=350><tr bgcolor='#333333' width='350'><td width='250'><b><font color='#AAAAEE'>{$db_var['name']}</font></b> ( {$db_var['min']} .. {$db_var['max']} )</td><td align='right' width='100'><input type='text' name='{$db_var['name']}' value='{$db_var['value']}' size='8' /></td></tr><tr bgcolor='#555555' width='350'><td colspan='2' width='350'><blockquote>{$db_var['descript']} <p />Server Default: <b>{$db_var['default_value']}</b></blockquote></td></tr></table><br />";
    $db_var = dbr(1);
}
$out .= "<p /><input type='submit' value='Submit Vars' />";
$out .= "<br /></form>";
$rs = "<p /><a href='location.php'>Back to Star System</a>";
print_page("Admin", $out);
Esempio n. 27
0
                $items['bidder_id'] = print_name($bidder);
                $items['timestamp'] = date("M d - H:i", $items['timestamp'] + $bilkos_seconds);
            } else {
                $items['bidder_id'] = "None Yet";
                $items['timestamp'] = date("M d - H:i", $items['timestamp'] + $bilkos_seconds * 2);
            }
            $items['item_id'] = " - <a href='bilkos.php?bid={$items['item_id']}'>" . $cw['bid'] . "</a>";
            $text .= make_row($items);
            $items = dbr2(1);
        }
        $text .= "</table>";
    }
}
if ($show_won) {
    #Show items user has won.
    db2("select item_name,item_type,item_id from {$db_name}_bilkos where active=0 && bidder_id='{$user['login_id']}'");
    $collect = dbr2(1);
    if ($collect) {
        $text .= "<p />";
        $text .= $st[360];
        $text .= make_table(array("Item Name", "Item Type"));
        while ($collect) {
            if ($collect[item_type] == 1) {
                $collect[item_type] = $cw['ship'];
            } elseif ($collect[item_type] == 2) {
                $collect[item_type] = $cw['equipment'];
            } elseif ($collect[item_type] == 3) {
                $collect[item_type] = $cw['upgrade'];
            } elseif ($collect[item_type] == 4) {
                $collect[item_type] = $cw['misc'];
            } elseif ($collect[item_type] == 5) {