2015-08-13 3 views
0

Я пытаюсь получить коробку вокруг 2 разных полей ввода, сценарий пингует игровой сервер и возвращает информацию, но пинги 2 сервера, которые я хочу, чтобы они были помещены внутри коробки вместо того, чтобы просто наложить сайт грязныйHtml Box Вокруг живого ввода

<?php 
// Include the main class file 
require '../GameQ.php'; 

// Define your servers, 
// see list.php for all supported games and identifiers. 
$servers = array(
    array(
     'id' => 'BF4', 
     'type' => 'bf4', 
     'host' => '192.223.29.138:47200', 
    ), 
    array(
     'id' => 'GMOD', 
     'type' => 'gmod', 
     'host' => '31.186.251.28:27015', 
    ) 
); 


// Call the class, and add your servers. 
$gq = new GameQ(); 
$gq->addServers($servers); 

// You can optionally specify some settings 
$gq->setOption('timeout', 4); // Seconds 

// You can optionally specify some output filters, 
// these will be applied to the results obtained. 
$gq->setFilter('normalise'); 

// Send requests, and parse the data 
$results = $gq->requestData(); 


// Some functions to print the results 
function print_results($results) { 

    foreach ($results as $id => $data) { 

     printf("<h2>%s</h2>\n", $id); 
     print_table($data); 
    } 

} 

function print_table($data) { 

    $gqs = array('gq_online', 'gq_address', 'gq_port', 'gq_prot', 'gq_type'); 


    if (!$data['gq_online']) { 
     printf("<p>The server did not respond within the specified time.</p>\n"); 
     return; 
    } 

    print("<table><thead><tr><td>Variable</td><td>Value</td></tr></thead><tbody>\n"); 

    foreach ($data as $key => $val) { 

     if (is_array($val)) continue; 

     $cls = empty($cls) ? ' class="uneven"' : ''; 

     if (substr($key, 0, 3) == 'gq_') { 
      $kcls = (in_array($key, $gqs)) ? 'always' : 'normalise'; 
      $key = sprintf("<span class=\"key-%s\">%s</span>", $kcls, $key); 
     } 

     printf("<tr%s><td>%s</td><td>%s</td></tr>\n", $cls, $key, $val); 
    } 

    print("</tbody></table>\n"); 

} 

?> 
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> 
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> 
    <head> 
     <title>Game List</title> 
     <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> 
     <link rel="stylesheet" href="style.css" />   
     </style> 
    </head> 
    <body> 
    <h1>Game List</h1> 
    <div id="chat"> 
    Server List. <br/> 
     Click <a href="list.php">here</a> for a list of supported games. 
    </div> 

<?php 
    print_results($results); 
?> 
    </body> 
</html> 

CSS-

body { 
    background-image: url("bg.jpg"); 
} 
table td { 
    color: #cccccc; // OR WHATEVER 
} 
h1 { 
    color: #00ff00; 
} 
#chat { 
color: #00ff00; 
} 

ответ

0

Добавьте CSS, чтобы изменить нужный цвет шрифта. Текст не входит в черный цвет, это только цвет шрифта по умолчанию для браузеров.

table td { 
    color: #123456; // OR WHATEVER 
} 
+0

эй спасибо, что сработал, но если я проверю наверху, у него есть ярлык bf4, он не меняется, как вход? –

+0

@LinuxUnix Мне нужно будет увидеть, как ваш код отвечает на это – bones

+0

@LinuxUnix, нм я вижу выше. просто используйте В противном случае вы можете использовать то, что у вас есть, и переместить свой CSS в новый файл style.css – bones

Смежные вопросы