Raised This Month: $ Target: $400
 0% 

Trash this one


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
kramesa
Veteran Member
Join Date: Feb 2011
Location: Brazil
Old 04-25-2012 , 19:31   Re: Want an simple PHP script for website with div id="serverstatus"
Reply With Quote #11

Don't works

Look:

Code:
<?php require_once('JG_Cache.php'); require_once('SourceQuery.class.php'); $servers = array( 'server_01' => array ('name' => 'Server #1', 'ip' => '189.38.58.98', 'port' => '27036') ); foreach ($servers as $server) {   $cache = new JG_Cache('/tmp');   $info = $cache->get($server['name'], 60); // second paramater = cache time in seconds   if ($info === false) {     $query = new SourceQuery();     try {       $query->Connect($server['ip'], $server['port']);       $info = $query->GetInfo();     } catch (SourceQueryException $e) {       $info = $e->getMessage();     }     //$cache->set($server['name'], $info);   }   if (is_array($info)) {     echo '<div style="color:#fff;">' . $server['ip'] . ':' . $server['port'] . ' | map: ' . $info['Map'] . ' | players: ' . $info['Players'] . '/' . $info['MaxPlayers'] . '</div>';   }   else {     echo '<div style="color:#ff0000;">' . $server['ip'] . ':' . $server['port'] . ' (offline)</div>';   } }
__________________
kramesa is offline
 



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 02:52.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode