PHP Classes
elePHPant
Icontem

File: action.php

Recommend this page to a friend!
  Classes of Steffen Stollfuß  >  gameserver.class.inc  >  action.php  >  Download  
File: action.php
Role: Example script
Content type: text/plain
Description: Example File
Class: gameserver.class.inc
Get Status for many GameServer
Author: By
Last change: ................
Date: 13 years ago
Size: 9,119 bytes
 

Contents

Class file image Download
<?php
/*
  File: action.php
  Author: Jointy
  E-Mail: bestmischmaker@web.de

  create: 05.03.2003
  last change: 01.05.2003 00:07
 
  version 0.42 (beta)
 
  !!! Only sample file !!!

*/
require("gameserver.class.inc");
$srv_type=$_POST['type'];

if(
$srv_type == "q3a"){
    echo
'<html><head><title>Quake 3 Arena Server Status Script by Jointy</title>
         <META HTTP-EQUIV="Pragma" CONTENT="no-cache">
         <META HTTP-EQUIV="Expires" CONTENT="-1">
         </head>
         <style type="text/css">
         <!--
         th {
         background: #FF7D00;
         }
         td {
         text-align: center;
         background: #00C3FF;
         }

         -->
         </style>
         <body>'
;



   
$srv_addr=$_POST['serverip'];
   
$srv_port=$_POST['serverport'];


   
$q3a = new GAMESERVER($srv_type);

   
// echo $srv_type.$q3a;

   
$srv_info = $q3a->get_stats($srv_addr,$srv_port);

   
print_r($srv_info);

    if (
$srv_info['sv_punkbuster'] == "0"){
      
$punkbuster="No";
    }elseif(
$srv_info['sv_punkbuster']== "1"){
      
$punkbuster="Yes";
    }

    if (
$srv_info['g_needpass'] == "0"){
      
$needpass="No";
    }elseif(
$srv_info['g_needpass']== "1"){
      
$needpass="Yes";
    }

    if (
$srv_info['sv_allowDownload'] == "0"){
      
$allow_dl="No";
    }elseif(
$srv_info['sv_allowDownload]']== "1"){
      
$allow_dl="Yes";
    }

    echo
'<table>
         <tr>
          <th colspan="10">Server Infos </th>
         </tr>
         <tr>
          <th>Server IP / Port</th>
          <th>Hostname</th>
          <th>Server OS/Version</th>
          <th>Protocol</th>
          <th>Online Players / Max Clients</th>
          <th>Red Team</th>
          <th>Blue Team</th>
          <th>Punkbuster</th>
          <th>Passwort</th>
          <th>Allow Download</th>
         </tr>
         <tr>
          <td>'
.$srv_addr.':'.$srv_port.'</td>
          <td>'
.$srv_info['sv_hostname'].'</td>
          <td>'
.$srv_info['version'].'</td>
          <td>'
.$srv_info['protocol'].'</td>
          <td>('
.$srv_info['player_count'].')/'.$srv_info['sv_maxclients'].'</td>
          <td>'
.$srv_info['red_team'].'</td>
          <td>'
.$srv_info['blue_team'].'</td>
          <td>'
.$punkbuster.'</td>
          <td>'
.$needpass.'</td>
          <td>'
.$allow_dl.'</td>
         </tr>
         <tr></tr>
         <tr>
          <th colspan="6" bgcolor="#0082FF" >Admin Infos</th>
         </tr>
         <tr>
          <th>Administrator</th>
          <th>E-Mail</th>
          <th>Website</th>
          <th> ICQ </th>
          <th> IRC </th>
          <th> Location </th>
         </tr>
         <tr>
          <td>'
.$srv_info['admin'].'</td>
          <td>'
.$srv_info['email'].'</td>
          <td>'
.$srv_info['website'].'</td>
          <td>'
.$srv_info['icq'].'</td>
          <td>'
.$srv_info['irc'].'</td>
          <td>'
.$srv_info['location'].'</td>
         </tr>
         <tr></tr>
         <tr>
          <th colspan="9">Game/Mod Infos</th>
         </tr>
         <tr>
          <th> Gamename / Gametype </th>
          <th> Gameversion </th>
          <th> Map </th>
          <th> Capture Limit </th>
          <th> Time Limit </th>
          <th> Frag Limit </th>
          <th> Max Rate </th>
          <th> Min Ping </th>
          <th> Max Ping </th>
         </tr>
         <tr>
          <td>'
.$srv_info['gamename'].'('.$srv_info['g_gametype'].')</td>
          <td>'
.$srv_info['gameversion'].'</td>
          <td>'
.$srv_info['mapname'].'</td>
          <td>'
.$srv_info['capturelimit'].'</td>
          <td>'
.$srv_info['timelimit'].'</td>
          <td>'
.$srv_info['fraglimit'].'</td>
          <td>'
.$srv_info['sv_maxRate'].'</td>
          <td>'
.$srv_info['sv_minPing'].'</td>
          <td>'
.$srv_info['sv_maxPing'].'</td>
         </tr>'
;

    echo
'<tr><th colspan="4">Player Infos</th></tr>
         <tr>
          <th> Nr. </th>
          <th> Playername </th>
          <th> Ping </th>
          <th> Punkte </th>
         </tr>'
;

    if(
$srv_info['player_count'] != "0"){
       for(
$i=1;$i<=$srv_info['player_count'];$i++){
           echo
'<tr>
              <td>'
.$i.'</td>
              <td>'
.$srv_info['player_'.$i.'_name'].'</td>
              <td>'
.$srv_info['player_'.$i.'_ping'].'</td>
              <td>'
.$srv_info['player_'.$i.'_points'].'</td>
              </tr>'
;
       }

    }else{
        echo
'<tr>
          <td>'
.$srv_info['player_count'].'</td>
          <td>Kein Spieler online</td>
          <td></td>
          <td></td>
          </tr>'
;
    }




}elseif(
$srv_type == "q2"){

   
$gs = new GAMESERVER ($srv_type);

    echo
'<html><head><title>Quake 2 Server Status Script by Jointy</title>
         <META HTTP-EQUIV="Pragma" CONTENT="no-cache">
         <META HTTP-EQUIV="Expires" CONTENT="-1">
         </head>
         <style type="text/css">
         <!--
         th {
         background: #FF7D00;
         }
         td {
         text-align: center;
         background: #00C3FF;
         }

         -->
         </style>
         <body>'
;

   
$srv_info = $gs->get_stats($_POST['serverip'],$_POST['serverport']);
   
   
print_r($srv_info);
    if(
$srv_info['needpass'] == "0") $needpass = "No";
    if(
$srv_info['needpass'] == "1") $needpass = "Yes";
   

   
    echo
'<table>
         <tr>
          <th colspan="10">Server Infos </th>
         </tr>
         <tr>
          <th>Server IP / Port</th>
          <th>Hostname</th>
          <th>Server OS/Version</th>
          <th>Protocol</th>
          <th>Online Players / Max Clients</th>
          <th colspan="3">Models</th>
          <th>Passwort</th>
          <th>DM Flags </th>
         </tr>
         <tr>
          <td>'
.$_POST['serverip'].':'.$_POST['serverport'].'</td>
          <td>'
.$srv_info['hostname'].'</td>
          <td>'
.$srv_info['version'].'</td>
          <td>'
.$srv_info['protocol'].'</td>
          <td>('
.$srv_info['player_count'].')/'.$srv_info['maxclients'].'</td>
          <td colspan="3">'
.$srv_info['models'].'</td>
          <td>'
.$needpass.'</td>
          <td>'
.$srv_info['dmflags'].'</td>
         </tr>
         <tr></tr>
         <tr>
          <th colspan="10" bgcolor="#0082FF" >Admin Infos</th>
         </tr>
         <tr>
          <th>Administrator</th>
          <th>E-Mail</th>
          <th>Website</th>
          <th> ICQ </th>
          <th> IRC </th>
          <th> Location </th>
         </tr>
         <tr>
          <td>'
.$srv_info['admin'].'</td>
          <td>'
.$srv_info['email'].'</td>
          <td>'
.$srv_info['website'].'</td>
          <td>'
.$srv_info['icq'].'</td>
          <td>'
.$srv_info['irc'].'</td>
          <td>'
.$srv_info['location'].'</td>
         </tr>
         <tr></tr>
         <tr>
          <th colspan="9">Game/Mod Infos</th>
         </tr>
         <tr>
          <th> Gamename / Gametype </th>
          <th> Gameversion </th>
          <th> Map </th>
          <th> Capture Limit </th>
          <th> Time Limit </th>
          <th> Frag Limit </th>
          <th> Max Rate </th>
          <th> Features </th>
          <th> Max FPS </th>
         </tr>
         <tr>
          <td>'
.$srv_info['gamename'].'</td>
          <td>'
.$srv_info['gameversion'].'</td>
          <td>'
.$srv_info['mapname'].'</td>
          <td>'
.$srv_info['capturelimit'].'</td>
          <td>'
.$srv_info['timelimit'].'</td>
          <td>'
.$srv_info['fraglimit'].'</td>
          <td>'
.$srv_info['max_rate'].'</td>
          <td>'
.$srv_info['features'].'</td>
          <td>'
.$srv_info['max_fps'].'</td>
         </tr>'
;
        
   
// Player Stats
   
echo '<tr><th colspan="4">Player Infos</th></tr>
         <tr>
          <th> Nr. </th>
          <th> Playername </th>
          <th> Ping </th>
          <th> Punkte </th>
         </tr>'
;

    if(
$srv_info['player_count']!= "0"){
       for(
$i=1;$i<=$srv_info['player_count'];$i++){
           echo
'<tr>
              <td>'
.$i.'</td>
              <td>'
.$srv_info['player_'.$i.'_name'].'</td>
              <td>'
.$srv_info['player_'.$i.'_ping'].'</td>
              <td>'
.$srv_info['player_'.$i.'_points'].'</td>
              </tr>'
;
       }

    }else{
        echo
'<tr>
          <td>'
.$srv_info['player_count'].'</td>
          <td>Kein Spieler online</td>
          <td></td>
          <td></td>
          </tr>'
;
    }

}elseif(
$srv_type == "hl"){
   
$gs = new GAMESERVER( $srv_type );
   
   
$srv_info = $gs->get_stats($_POST['serverip'],$_POST['serverport']);
   
   
print_r($srv_info);


}elseif(
$srv_type == "ut"){
   
$gs = new GAMESERVER( $srv_type );
   
   
$srv_info = $gs->get_stats($_POST['serverip'],$_POST['serverport']);
   
   
print_r($srv_info);
}

echo
"<tr>
       <th> Error: </th>
       <td>"
.$srv_info['error']."</td>
      </tr>
      </table></body></html>"
;

?>