Re: gameserver


Code PHP :
Pour copier le contenu exact du code,
Veuillez citer le message
  1.  
  2. <?php
  3.  
  4. /*
  5.  *
  6.  * Gameserver - A PHPNuke module for querying Gameservers
  7.  * Copyright (C) 2002 Jeremias Reith (email anti-spam)
  8.  *
  9.  * This program is free software; you can redistribute it and/or
  10.  * modify it under the terms of the GNU General Public License
  11.  * as published by the Free Software Foundation; either version 2
  12.  * of the License, or (at your option) any later version.
  13.  *
  14.  * This program is distributed in the hope that it will be useful,
  15.  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  16.  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  17.  * GNU General Public License for more details.
  18.  *
  19.  * You should have received a copy of the GNU General Public License
  20.  * along with this program; if not, write to the Free Software
  21.  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
  22.  *
  23. adapté pwsphp par zeta */
  24.  
  25.  
  26. $module_name=gameserver;
  27.  
  28. include("modules/$module_name/gsQuery.php");
  29. $currentlang="french";
  30. //needed to support different languages
  31. include("modules/$module_name/language/lang-".$currentlang.".php");
  32.  
  33. // get all gameservers
  34. $result = reqmysql("select id, shortname, address, queryport, protocol, show_in_block from gameserver where show_in_block<>"no" order by name");
  35. if(!$result) { return; }
  36. $numrows = mysql_num_rows($result);
  37.  
  38. // no servers found
  39. if ($numrows == 0) {
  40.   return;
  41. }
  42.  
  43. while(list($id, $shortname, $address, $queryport, $protocol, $show_in_block)=mysql_fetch_array($result)) {
  44.  
  45.   $gameServer=new gsQuery($address,$queryport);
  46.  
  47.   if(!$gameServer->query_server($protocol,FALSE,FALSE)) {
  48.     if(strtolower($show_in_block)=="yes") {
  49.       if($num_servers++) { $boxstuff.="<br>"; }
  50.       $boxstuff.="<table border="0">"
  51.     ."<tr><td></td><td><b>".$shortname."</b></td></tr>"
  52.     ."<tr><td>"._STATUS.":</td><td>"._OFFLINE."</td></tr>"
  53.     ."</table>";
  54.     }
  55.   } else {
  56.  
  57.     switch($gameServer->password) {
  58.  
  59.     case 1:
  60.     case "True":
  61.     case "true":
  62.       $status=_PRIVATE;
  63.       break;
  64.     case 0:
  65.       $status=_PUBLIC;
  66.       break;
  67.     default:
  68.       $status=_UNKNOWN;
  69.     }
  70.  
  71.     if($num_servers++) $boxstuff.="<br>"; // instert a <br> between the servers
  72.     $boxstuff.="<center><b>".$shortname."</b></center>";
  73.     $boxstuff.="<table border="0">";
  74.     if($status!=_UNKNOWN) {
  75.       $boxstuff.="<tr><td>"._STATUS.":</td><td>".$status."</td></tr>";
  76.     }
  77.  
  78.     $boxstuff.="<tr><td>"._GAMEMODE.":</td><td>". $gameServer->gametype ."</td></tr>";
  79.  
  80.     // the mapname is sometimes larger than the box (So maptitle is chosen if available).
  81.     if($gameServer->maptitle=="") {
  82.       $boxstuff.="<tr><td>"._MAP.":</td><td>". $gameServer->mapname ."</td></tr>";
  83.     } else {
  84.       $boxstuff.="<tr><td>"._MAP.":</td><td>". $gameServer->maptitle ."</td></tr>";
  85.     }
  86.  
  87.     $boxstuff.="<img src="modules/$module_name/images/".htmlentities($gameServer->gamename)."/".htmlentities($gameServer->mapname).".jpg"<tr><td>"._PLAYERS.":</td><td>". $gameServer->numplayers ."/". $gameServer->maxplayers . "</td></tr>"
  88.       ."</table>";
  89.     $boxstuff.="<center>[<a href="index.php?mod=gameserver&type=detail&serverid=$id">"._DETAILS."</a>]</center>";
  90.   }
  91. }
  92.  
  93. $content=$boxstuff;
  94. bloc($result_blocs->parametre1,$content);
  95.  
  96. ?>
  97.  



voila ce que j'ai exactement

Edité Dimanche 27 janvier 2008 :12:36 par fredoo


Sujet écrit par Ancien membre le dimanche 27 janvier 2008 à 12:36

[ Imprimer ] - [ Fermer la fenêtre ]