Metabolicman  | J'y ai apporté quelque modifs pour qu'il fonctionne avec la bdd:
  
  Code :
 - <table border="0" align="center" class="affichage2" width="60%">
 - <tr>
 - <td align="center" colspan="5" class="affichage2" style="font-size:11px;">
 - <font face="Arial, Helvetica, sans-serif"><b>Liste des serveurs</b></font>
 - </td>
 - </tr>
 - <tr>
 - <td align="center" class="affichage2" style="font-size:11px;">
 - <b>Serveur.</b>
 - </td>
 - <td align="center" class="affichage2" style="font-size:11px;">
 - <b>Adresse.</b>
 - </td>
 - <td align="center" class="affichage2" style="font-size:11px;">
 - <b>Port.</b>
 - </td>
 - <td align="center" class="affichage2" style="font-size:11px;">
 - <b>Statut.</b>
 - </td>
 - <td align="center" class="affichage2" style="font-size:11px;">
 - <b>Ping.</b>
 - </td>
 - </tr>
 - <?php
 - $req="select nom,adresse,port from eGL_serveur where id_lan='".$_SESSION['id_lan_en_cours']."'";
 - $res=eGL_query($req);
 - $i=0;
 - while($val=mysql_fetch_assoc($res))
 - {
 - $server[$i]['active'] = TRUE; // Autoriser ou non la connexion
 - $server[$i]['nom']=$val['nom'];
 - $server[$i]['port'] = $val['port']; // Port
 - $server[$i]['addr'] = $val['adresse']; // adresse du server
 - $i++;
 - }
 - function getmicrotime()
 - {
 - list ($usec, $sec) = explode(' ', microtime() );
 - return ( (float) $usec + (float) $sec);
 - }
 - for ($i = 0; $i <= count($server); $i++)
 - {
 - if ($server[$i]['active'] == TRUE)
 - {
 - if (is_array($server[$i]['port']))
 - {
 - $port = array();
 - $port = $server[$i]['port'];
 - }
 - else
 - {
 - $port = array();
 - $port[0] = $server[$i]['port'];
 - }
 - for ($j = 0; $j < count($port); $j++)
 - {
 - echo '<tr><td align="center" class="affichage2" height="20" style="font-size:11px;">'."\n";
 - echo $server[$i]['nom']."\n";
 - echo '</td><td align="center" class="affichage2" height="20" style="font-size:11px;">'."\n";
 - if ($j == 0)
 - {
 - echo $server[$i]['addr']."\n";
 - }
 - else
 - {
 - echo ' '."\n";
 - }
 - echo '</td><td align="center" class="affichage2" style="font-size:11px;">'."\n";
 - echo $port[$j]."\n";
 - echo '</td><td align="center" class="affichage2" style="font-size:11px;">'."\n";
 - $time_start = getmicrotime();
 - if ( @fsockopen( $server[$i]['addr'], $port[$j], &$errno, &$errstr, 5) )
 - {
 - echo '<font color="#00CC00"><b>Online</b></font>'."\n";
 - $time_end = getmicrotime();
 - $ping = round(($time_end - $time_start) * 1000);
 - }
 - else
 - {
 - echo '<font color="#CC0000"><b>Offline</b></font>'."\n";
 - $ping = '>5000';
 - }
 - echo '</td><td align="center" class="affichage2" style="font-size:11px;">'."\n";
 - echo $ping;
 - echo '</td></tr>'."\n";
 - }
 - }
 - }
 - ?>
 - </table>
 
  |  
    |