Raised This Month: $51 Target: $400
 12% 

Trash this one


Post New Thread Reply   
 
Thread Tools Display Modes
kramesa
Veteran Member
Join Date: Feb 2011
Location: Brazil
Old 05-01-2012 , 12:46   Re: Want an simple PHP script for website with div id="serverstatus"
Reply With Quote #51

Quote:
Originally Posted by xPaw View Post
I said HIS servers.
lol
__________________
kramesa is offline
jonnzus
Epic Member
Join Date: Oct 2010
Location: Finland
Old 05-02-2012 , 03:05   Re: Want an simple PHP script for website with div id="serverstatus"
Reply With Quote #52

I founded this, u can test it

E. i guess this this better bersion..
http://serverq.cvs.sourceforge.net/v...RENT/?view=tar
Attached Files
File Type: zip serverq.zip (26.4 KB, 41 views)
__________________
Quote:
367. Everyone's copyright will be broken. No exceptions.

Last edited by jonnzus; 05-02-2012 at 03:12.
jonnzus is offline
matrixmark
Senior Member
Join Date: Jun 2010
Old 05-02-2012 , 07:03   Re: Want an simple PHP script for website with div id="serverstatus"
Reply With Quote #53

Quote:
Originally Posted by jonnzus View Post
I founded this, u can test it

E. i guess this this better bersion..
http://serverq.cvs.sourceforge.net/v...RENT/?view=tar
Didnt work for me once I configured it as per the readme file.
matrixmark is offline
8088
Veteran Member
Join Date: Jan 2008
Old 05-02-2012 , 10:02   Re: Want an simple PHP script for website with div id="serverstatus"
Reply With Quote #54

That's because it uses the old, obsolete query protocol that's only useful for HLTV and silly non-Steam server owners like jonnzus. Besides, it can't normally query your servers. Instead it retrieves your server's status by using rcon. And to make things worse, it requires all of your servers to use the same port and rcon password. In other words: a waste of time.
Quote:
Originally Posted by jonnzus View Post
I founded this, u can test it
__________________
steamID converter with OpenSearch browser plugin

Last edited by 8088; 05-02-2012 at 10:04.
8088 is offline
8088
Veteran Member
Join Date: Jan 2008
Old 05-08-2012 , 19:30   Re: Trash this one
Reply With Quote #55

Quote:
Originally Posted by kramesa View Post
Hi, its possible make this:

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
__________________
steamID converter with OpenSearch browser plugin

Last edited by 8088; 05-08-2012 at 19:30. Reason: oops omer
8088 is offline
bazhenov93
Veteran Member
Join Date: Oct 2010
Old 05-08-2012 , 19:34   Re: Trash this one
Reply With Quote #56

Lol, most of you talking about non-steam, I have forget what is it.
bazhenov93 is offline
8088
Veteran Member
Join Date: Jan 2008
Old 05-08-2012 , 19:37   Re: Trash this one
Reply With Quote #57

Non-Steam is like non-alcoholic beer.
__________________
steamID converter with OpenSearch browser plugin

Last edited by 8088; 05-08-2012 at 19:38.
8088 is offline
bazhenov93
Veteran Member
Join Date: Oct 2010
Old 05-08-2012 , 19:39   Re: Trash this one
Reply With Quote #58

hahah you right. And thanks for the php, gonna test it.
bazhenov93 is offline
kramesa
Veteran Member
Join Date: Feb 2011
Location: Brazil
Old 05-08-2012 , 19:57   Re: Trash this one
Reply With Quote #59

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
O M G, I love you man

Thanks

Edit: How I can change the size of the letters?
__________________

Last edited by kramesa; 05-08-2012 at 20:17.
kramesa is offline
8088
Veteran Member
Join Date: Jan 2008
Old 05-08-2012 , 20:49   Re: Trash this one
Reply With Quote #60

The style is defined with CSS withing the <style> tags. To change the size of the letters, you can edit the line where it says font:10px Verdana;, or add attributes to the single element that you want to apply it to. For example, the anchor element:
Code:
a {
 font-size:16px;
}
http://www.w3.org/Style/CSS/learning.en.html
__________________
steamID converter with OpenSearch browser plugin
8088 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 18:49.


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