Example #1
0
function web_page()
{
    $db = new Database();
    $db->load();
    print '<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">';
    print "\n<html><head><title>Public Doomsday Servers</title></head>\n";
    print "<body>\n";
    print "<p>Server list at " . date("D, j M Y H:i:s O") . ":</p>\n";
    print "<table border=1 cellpadding=4>\n";
    print "<tr><th>Open <th>Location <th>Name <th>Info " . "<th>Version\n";
    //<th>Map <th>Setup <th>WAD <th>Players <th>Who's Playing?
    while (list($ident, $info) = each($db->servers)) {
        print "<tr><td>";
        print $info['open'] ? "Yes" : "<font color=\"red\">No</font>";
        print "<td>{$info['at']}:{$info['port']}";
        print "<td>" . $info['name'];
        print "<td>" . $info['info'];
        print "<td>Doomsday {$info['ver']}, {$info['game']}";
        print "<tr><td><th>Setup<td>";
        print "{$info['mode']} <td colspan=2>{$info['map']} {$info['setup']}";
        print "<tr><td><th>WADs<td colspan=3>";
        print "{$info['iwad']} (" . dechex($info['wcrc']) . ") {$info['pwads']}";
        print "<tr><td><th>Players<td colspan=3>";
        print "{$info['nump']} / {$info['maxp']}: ";
        print "{$info['plrn']}";
    }
    print "</table></body></html>\n";
    $db->close();
}
Example #2
0
 /**
  * Load a possibly cached item
  *
  * @param string $id
  * @return array|mixed|null
  */
 function load($id)
 {
     if (is_array($id)) {
         $results = array();
         foreach ($id as $i) {
             $results[$i] = $this->load($i);
         }
         return $results;
     }
     if (isset($this->map[$id])) {
         return $this->map[$id];
     } else {
         $data = $this->db->load($id);
         $this->map[$id] = $data;
         return $data;
     }
 }
Example #3
0
 function all()
 {
     global $conn;
     $arrayOfDatabases = array();
     $result = mysql_query("SHOW DATABASES", $conn);
     while ($row = mysql_fetch_row($result)) {
         $db = Database::load($row[0]);
         $arrayOfDatabases[] = $db;
     }
     sort($arrayOfDatabases);
     return $arrayOfDatabases;
 }
Example #4
0
<?php

error_reporting(E_ALL);
if (isset($_GET["search"])) {
    $input = $_GET["search"];
}
//print_r($_GET);
require 'Database.php';
$db = new Database(array('data/station.xml', 'data/address.xml'));
$db->load();
$s = $db->search($input);
echo $s;