Raised This Month: $32 Target: $400
 8% 

Trash this one


Post New Thread Reply   
 
Thread Tools Display Modes
worset
Junior Member
Join Date: May 2012
Location: in game
Old 05-17-2012 , 14:41   Re: Trash this one
Reply With Quote #91

Quote:
Originally Posted by 8088 View Post
Ok, thanks.
worset is offline
kramesa
Veteran Member
Join Date: Feb 2011
Location: Brazil
Old 05-22-2012 , 12:09   Re: Trash this one
Reply With Quote #92

Quote:
Originally Posted by 8088 View Post
http://awesomatic.net/crap/status/styled.php
PHP Code:
<?php
ini_set
("display_errors""2");
ERROR_REPORTING(E_ALL);

require_once(
'JG_Cache.php');
require_once(
'SourceQuery.class.php');

$servers = array(
// add servers like this:
//'server_01' => array ('name' => 'My shitty server', 'ip' => 'abc.example.com', 'port' => '27015'),
  
'server_02' => array('name' => 'My crap server''ip' => '8.6.2.43''port' => '27015'),
  
'server_03' => array('name' => 'My awesome server''ip' => '189.74.29.220''port' => '27015')
);


$i 0;
$rows = array();
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 (
$i == 0)
  {
    
$class 'even';
  }
  else
  {
    
$class 'odd';
  }

  if (
is_array($info))
  {
    
$rows[$i]['class'] = $class;
    
$rows[$i]['ip'] = $server['ip'];
    
$rows[$i]['port'] = $server['port'];
    
$rows[$i]['map'] = $info['Map'];
    
$rows[$i]['players'] = $info['Players'];
    
$rows[$i]['maxplayers'] = $info['MaxPlayers'];
    
$rows[$i]['servername'] = $info['HostName'];
    
$rows[$i]['a_class'] = 'online';
  }
  else
  {
    
$rows[$i]['class'] = $class;
    
$rows[$i]['ip'] = $server['ip'];
    
$rows[$i]['port'] = $server['port'];
    
$rows[$i]['map'] = 'n/a';
    
$rows[$i]['players'] = 'n';
    
$rows[$i]['maxplayers'] = 'a';
    
$rows[$i]['servername'] = $server['name'];
    
$rows[$i]['a_class'] = 'offline';
  }
  
$i++;
}
?>
<!DOCTYPE html>
<html>
  <head>
    <meta charset="utf-8">
    <title>hi</title>
    <style>
      html, body {
        font:10px Verdana;
      }
      table {
        background-color:#eeeded;
      }
      td, th {
        padding:5px;
      }

      th {
        background-color:#212121;
        color:#fff;
        text-transform:capitalize;
      }
      .odd {
        background-color:#dcdcdc;
      }

      a, a:visited {
        display:block;
        color:#fff;
        background-color:#51a619;
        padding:5px;
        border-radius: 5px;
        border:1px solid #357f07;
        text-decoration:none;
      }
      a.offline {
        background-color:#c51c00;
        border:1px solid #300700;            
      }
      a:hover, a.offline:hover {
        color:#51a619;
        background-color:#fff;
      }
      tfoot td {
        text-align:right;
      }            
    </style>
  </head>
  <body>
    <table>
      <thead>
        <tr>
          <th>server</th><th>players</th><th>map</th><th></th>
        </tr>
      </thead>
      <tbody>
        <?php foreach ($rows as $row): ?>
          <tr class="<?php echo $row['class']; ?>">
            <td><?php echo htmlspecialchars($row['servername']); ?></td>
            <td><?php echo $row['players']; ?>/<?php echo $row['maxplayers']; ?></td>
            <td><?php echo htmlspecialchars($row['map']); ?></td>
            <td>
              <a class="<?php echo $row['a_class']; ?>" href="steam://connect/<?php echo $row['ip'] . ':' $row['port']; ?>" title="connect">connect</a>
            </td>
          </tr>
        <?php endforeach; ?>
      </tbody>
      <tfoot>
        <tr>
          <td colspan="4"><?php echo count($rows) . ' items'?></td>
        </tr>
      </tfoot>
    </table>
  </body>
</html>
@omer: you're a dick
How can I change the font color?

Edit: Already solved!
__________________

Last edited by kramesa; 05-22-2012 at 12:38.
kramesa is offline
8088
Veteran Member
Join Date: Jan 2008
Old 05-22-2012 , 16:24   Re: Trash this one
Reply With Quote #93

Quote:
Originally Posted by kramesa View Post
How can I change the font color?
You asked a similar question before in this thread and got the answer here: http://forums.alliedmods.net/showpos...5&postcount=61
Quote:
Edit: Already solved!
Thanks for keeping your solution to yourself and not contributing anything...again. No more support for you, me thinks.
__________________
steamID converter with OpenSearch browser plugin

Last edited by 8088; 05-22-2012 at 16:26.
8088 is offline
mydyingbride
Zero Posts
Join Date: Sep 2012
Old 09-17-2012 , 21:36   Re: Trash this one
Reply With Quote #94

How would I go about sorting GetPlayers( ); by amount of frags from most to least?

New to PHP but I tried $info = $query->GetPlayers( "ORDER BY 'Frags' DESC" ); but that didn't work. Can anyone help?
mydyingbride is offline
Reply



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 10:09.


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