Advertisement
Guest User

Untitled

a guest
Jul 5th, 2015
208
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 2.84 KB | None | 0 0
  1. <!DOCTYPE html>
  2. <html>
  3.     <head>
  4.         <meta charset="utf-8" />
  5.         <link rel="stylesheet" href="style.css" />
  6.         <title>Nanotech hunger games stats</title>
  7.     </head>
  8.         <body>
  9.                    
  10. <?php
  11.  
  12. $request = file_get_contents('./stats.php', FILE_USE_INCLUDE_PATH);
  13. $jsonObject =json_decode($request);
  14. echo $jsonObject;
  15. foreach($jsonObject as $key => $value)
  16. {
  17.     $userInfos = $value; ?>
  18.     <p class="user">
  19.     <strong>Pseudo</strong>: <?php echo ($userInfos->{'username'});
  20.     echo '<br/>';
  21.     echo 'Il a joué : ';
  22.     if($userInfos->{'games'} == 1)
  23.     {
  24.         echo ($userInfos->{'games'} . ' partie');
  25.     }
  26.     else
  27.     {
  28.         echo ($userInfos->{'games'} . ' parties');
  29.     }?>, a tué <?php
  30.     if($userInfos->{'kills'} == 0)
  31.     {
  32.         echo "aucune personne";
  33.     }
  34.     elseif($userInfos->{'kills'} == 1)
  35.     {
  36.         echo ($userInfos->{'kills'} . ' personne');
  37.     }
  38.     else
  39.     {
  40.         echo ($userInfos->{'kills'} . ' personnes');
  41.     }?>, est mort <?php
  42.     if($userInfos->{'deaths'} == 0)
  43.     {
  44.         echo "aucune fois ";
  45.     }
  46.     else
  47.     {
  48.         echo ($userInfos->{'deaths'} . ' fois ');
  49.     }?>et a gagné <?php
  50.     if($userInfos->{'wonGames'} == 0)
  51.     {
  52.         echo "aucune partie";
  53.     }
  54.     elseif($userInfos->{'wonGames'} == 1)
  55.     {
  56.         echo ($userInfos->{'wonGames'} . ' partie');
  57.     }
  58.     else
  59.     {
  60.         echo ($userInfos->{'wonGames'} . ' parties');
  61.     }?>. Il a été spectateur <?php
  62.     if($userInfos->{'spectatorGames'} == 0)
  63.     {
  64.         echo "aucune fois ";
  65.     }
  66.     else
  67.     {
  68.         echo ($userInfos->{'spectatorGames'} . ' fois ');
  69.     }?>et a choisit le kit aléatoire <?php
  70.     if($userInfos->{'chooseRandomKit'} == 0)
  71.     {
  72.         echo "aucune fois";
  73.     }
  74.     else
  75.     {
  76.         echo ($userInfos->{'chooseRandomKit'} . ' fois');
  77.     }?>.<br />
  78.    
  79.         <table>
  80.             <tr class="desc">
  81.                 <td class="desc">Kits</td>
  82.                 <?php foreach($userInfos->{'kits'} as $kitsKey => $kitsValue)
  83.                 { ?>
  84.                 <td><?php echo $kitsKey;?></td>
  85.                 <?php }?>
  86.             </tr>
  87.             <tr>
  88.                 <td class="desc">Parties</td>
  89.                 <?php foreach($userInfos->{'kits'} as $kitsKey => $kitsValue)
  90.                 { ?>
  91.                 <td><?php echo ($kitsValue->{'uses'});?></td>
  92.                 <?php }?>
  93.             </tr>
  94.             <tr>
  95.                 <td class="desc">Victoires</td>
  96.                 <?php foreach($userInfos->{'kits'} as $kitsKey => $kitsValue)
  97.                 { ?>
  98.                 <td><?php if(isset($kitsValue->{'won'}) == null)
  99.                 {
  100.                     echo '0';
  101.                 }
  102.                 else
  103.                 {
  104.                     echo ($kitsValue->{'won'});
  105.                 }?></td>
  106.                 <?php }?>
  107.             </tr>
  108.         </table>
  109.     </p>
  110. <?php }?>
  111. </td>
  112.             </tr>  
  113.  
  114.     </body>
  115. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement