Пример #1
0
function px_execute($px_cmd, $px_k, $px_v)
{
    for ($i = 0; $i != 16; $i++) {
        $data[$px_k[$i]] = $px_v[$i];
    }
    comm_init_server();
    comm_s2s($px_cmd, $data);
    $pkg = comm_recv_from_server();
    comm_fini_server();
    echo "<table align=center>\n";
    echo "<tr><th colspan=2>PX_Server Output</th></tr>\n";
    reset($pkg);
    while (list($key, $val) = each($pkg)) {
        echo "<tr class=bl><td>" . $key . "</td><td>" . $val . "</td></tr>\n";
    }
    echo "</table>\n";
    echo "<br><br>\n";
}
Пример #2
0
<?php

// Include Files
include "includes.inc.php";
// Session Identification
session_identification();
// Extra headers for TD..
print_header();
print_title("Attack", "Blahdieblahdieblah");
// Simulate attack
$data['attack_id'] = "V0";
$data['defense_id'] = "V1";
$data['battlecount'] = 25;
comm_init_server();
comm_s2s("SIMATTACK", $data);
$pkg = comm_recv_from_server();
comm_fini_server();
$wins = $pkg['wins'];
$draws = $pkg['draws'];
$losses = $pkg['losses'];
$avg_a_defense = $pkg['avg_a_defense'];
$avg_a_strength = $pkg['avg_a_strength'];
$avg_d_defense = $pkg['avg_d_defense'];
$avg_d_strength = $pkg['avg_d_strength'];
$recommendation = $pkg['recommendation'];
// Show table
echo "<table align=center width=75%>\n";
echo "<tr><td><center><img src=\"" . $_CONFIG['URL'] . $_GALAXY['image_dir'] . "/vessels/1.jpg\" width=150 height=150></center></td><td>\n";
echo "  <table align=center>\n";
echo "    <tr class=bl><th colspan=3>Strategic statistics for<br>Vessel Orion Battle 1 vs Planet Orion Prime</th></tr>\n";
echo "    <tr class=bl><td align=right>" . $wins . "</td><th width=40%>Wins</th><td>" . $losses . "</td></tr>\n";
Пример #3
0
function comm_send_to_server($command = "NOOP", $data = "", $ok = "", $errors = "")
{
    assert(!empty($command));
    assert(!empty($data));
    global $_USER;
    global $_CONFIG;
    $data['galaxy'] = $_USER['galaxy_db'];
    if ($data['galaxy'] == "") {
        $data['galaxy'] = $_CONFIG['default_db'];
    }
    comm_init_server();
    comm_s2s($command, $data);
    $pkg = comm_recv_from_server();
    comm_fini_server();
    if ($pkg['status'] == "STATUS_OK") {
        if ($ok != "") {
            print_line($ok);
        }
        return 1;
    }
    if ($pkg['status'] == "STATUS_ERR") {
        if (isset($pkg['msg'])) {
            $errorstr = $errors[$pkg['msg']];
        } else {
            $errorstr = "";
            $pkg['msg'] = "No additional information available";
        }
        if (empty($errorstr)) {
            print_line("An unknown error occurred. The message is: " . $pkg['msg']);
        } else {
            print_line("Processing Error: " . $errorstr);
            return $pkg['msg'];
        }
    }
    return 0;
}