Code php

Fermé
Utilisateur anonyme - Modifié par Whismeril le 16/04/2015 à 18:11
Whismeril Messages postés 19030 Date d'inscription mardi 11 mars 2003 Statut Contributeur Dernière intervention 27 avril 2024 - 16 avril 2015 à 18:12
j'aimerais que il y as une zone de texte ou ils doivent mettre une ip et un port et que quand il clic sur un bontons envoyer il se mettent dans mon code


mon code :

<?php
 
        define( 'MQ_SERVER_ADDR', 'ip ici' ); 
        define( 'MQ_SERVER_PORT', et le port ici ); 
        define( 'MQ_TIMEOUT', 1 );
        // Edit this <-
 
        // Display everything in browser, because some people can't look in logs for errors
        Error_Reporting( E_ALL | E_STRICT );
        Ini_Set( 'display_errors', true );
 
        require __DIR__ . '/MinecraftQuery.class.php';
 
        $Timer = MicroTime( true );
        $Query = new MinecraftQuery( );
 
        try
        {
                $Query->Connect( MQ_SERVER_ADDR, MQ_SERVER_PORT, MQ_TIMEOUT );
        }
        catch( MinecraftQueryException $e )
        {
                $Error = $e->getMessage( );
        }
?>
 
 
<?php if( isset( $Error ) ): ?>
 
                        Exception:
                        <?php echo htmlspecialchars( $Error ); ?>
 
        <?php else: ?>
 
        <h3>Infos et Joueurs</h3>
 
        <?php
 
           function preint_r($array)
   {
      echo '<pre>';
      print_r($array);
      echo '</pre>';
   }
 
        echo preint_r($Query); ?>
 
        <?php if( ( $Players = $Query->GetPlayers( ) ) !== false ): ?>
                <?php foreach( $Players as $Player ): ?>
 
 
                        <?php
                       
                        echo htmlspecialchars( $Player );
                        echo '<img src="[https://minotar.net/avatar/ https://minotar.net/avatar/'.|nofollow]$Player.'/300.png"/ width="20" height="20">';
                        ?>
 
 
                <?php endforeach; ?>
               
        <?php else: ?>                                         
                Aucun joueur de connecté !
        <?php endif; ?>
 
<?php endif; ?>


EDIT: Ajout de la coloration syntaxique.
A voir également:

1 réponse

Whismeril Messages postés 19030 Date d'inscription mardi 11 mars 2003 Statut Contributeur Dernière intervention 27 avril 2024 931
16 avril 2015 à 18:12
.
0