Exemplo n.º 1
0
                <div id="recentResults">
                    <h2>Recent Results</h2>
                    Filter:
                    <select id="recSel">
                        <option>All</option>
                        <option>Winners</option>
                        <?php 
$result = $mysqli->query("Select distinct xgameno From sp_score Inner Join sp_game On gameno=xgameno Order by xgameno");
while ($row = $result->fetch_row()) {
    echo "<option>{$row[0]}</option>";
}
?>
                    </select>
                    <?php 
$query = "Select xgameno as Game\n                                   ,players as Players\n                                   ,powername as Superpower\n                                   ,username as Username\n                                   ,score as Score\n                                  From sp_score s\n                                      ,sp_game g\n                                      ,sp_users u\n                                  Where u.userno=s.userno\n                                      and gameno=xgameno\n                                  Order By xgameno, score desc\n                                  ";
deb_run_query($query);
?>
                </div>
            </div><!-- Right hand pane -->
        </div><!-- Outer row -->

    <?php 
require_once "m/php/footer_base.php";
?>

</div><!-- Container -->
    <script type="text/javascript"><!--
$(document).ready(function() {
    $('#recSel').change( function () {
        // Get rows in the right table
        var rows = $(this).parent().find('table tbody tr');
Exemplo n.º 2
0
<?php

// Regular scheduled script
// $Id: cron.php 252 2014-08-24 21:18:23Z paul $
// Connect to the database, no need to check the user as called by an Admin or cron job
require_once "utl_xml_table.php";
require_once "deb_run_query.php";
ob_start();
require_once "dbconnect.php";
ob_end_clean();
// First, create any new games
deb_run_query("call sr_new_game('Y')");
// Look for run away games
$mysqli->query("Update sp_game Set process=9 Where turnno/20 = Floor(turnno/20) and turnno>20");
// Look for queues to move
$query = "\nselect g.gameno\n ,g.turnno\n ,g.phaseno\n ,case when deadline_uts+auto_force < unix_timestamp() then 'FORCE' else '' end as autoforce\n ,sum(order_code in ('Orders received','Passed')) as processed\n ,count(r.userno) as players\nfrom sp_game g\nleft join sp_resource r\n on g.gameno=r.gameno\n and r.dead='N'\nleft join sp_orders o\n on g.gameno=o.gameno\n and r.userno=o.userno\n and o.ordername='ORDSTAT'\n and o.turnno=g.turnno\n and o.phaseno=g.phaseno\nwhere g.phaseno < 9\n and beta>=0\n and process is null\ngroup by 1, 2, 3\n";
$result = $mysqli->query($query, MYSQLI_STORE_RESULT) or die("CRON 001: " . $mysqli->error);
if ($result->num_rows > 0) {
    while ($row = $result->fetch_assoc()) {
        echo "\r\nGame: {$row['gameno']}  Turn: {$row['turnno']}  Phase: {$row['phaseno']}  Players: {$row['players']}  Processed: {$row['processed']}";
        // Further processing if ready
        if ($row['players'] == $row['processed'] or $row['autoforce'] == 'FORCE') {
            echo "\r\nProcessing queue for game: {$row['gameno']}";
            if ($row['autoforce'] == 'FORCE') {
                $forceXML = new SimpleXMLElement("<?xml version='1.0'?><FORCE><Forcer>AUTOFORCE</Forcer></FORCE>");
                $result3 = $mysqli->query("Select powername, userno, username From sv_current_orders Where gameno={$row['gameno']} and order_code like 'Waiting%'") or die("CRON 002: " . $mysqli->error);
                if ($result3->num_rows > 0) {
                    while ($row3 = $result3->fetch_assoc()) {
                        $forceXML->addChild(str_replace(" ", "", $row3['powername']), $row3['userno'] . '/' . $row3['username']);
                    }
                    $result3->close();