Site de la semaine d'accueil 2023
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

stats.php 2.0KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  1. <?php
  2. ob_start(); // Start reading html
  3. include "script/db.php";
  4. $req_p0 = $db->query('SELECT SUM(points) AS s FROM scores WHERE team = 0');
  5. $r0 = $req_p0->fetchAll(PDO::FETCH_ASSOC);
  6. if(!($r0[0]['s'] > 0)) {
  7. $r0[0]['s'] = 0;
  8. }
  9. $req_p1 = $db->query('SELECT SUM(points) AS s FROM scores WHERE team = 1');
  10. $r1 = $req_p1->fetchAll(PDO::FETCH_ASSOC);
  11. if(!($r1[0]['s'] > 0)) {
  12. $r1[0]['s'] = 0;
  13. }
  14. include "assets/scripts/globals.php"
  15. ?>
  16. <main>
  17. <div class="zone_txt">
  18. <strong>Les stats de la semaine.</strong>
  19. <br><br>
  20. Remporte le plus de points possible pour faire gagner ton équipe, mais attention à ne pas lui en faire
  21. perdre !
  22. <br><br>
  23. <table class="out">
  24. <tr>
  25. <td><div class="title_in"><?=$TEAM1?> - <?= $r0[0]['s'] ?> points</div></td>
  26. <td><div class="title_in"><?=$TEAM2?>- <?= $r1[0]['s'] ?> points</div></td>
  27. </tr>
  28. <tr>
  29. <td>
  30. <?php
  31. $req = $db->query('SELECT texte, points FROM scores WHERE team = 0 ORDER BY id DESC');
  32. while($r = $req->fetch()) {
  33. ?>
  34. <span class="box-point">
  35. <table class="in">
  36. <td class="left"><?= $r['texte'] ?></td>
  37. <td class="right"><?= $r['points'] ?></td>
  38. </table>
  39. </span>
  40. <?php
  41. }
  42. ?>
  43. </td>
  44. <td>
  45. <?php
  46. $req = $db->query('SELECT texte, points FROM scores WHERE team = 1 ORDER BY id DESC');
  47. while($r = $req->fetch()) {
  48. ?>
  49. <span class="box-point">
  50. <table class="in">
  51. <td class="left"><?= $r['texte'] ?></td>
  52. <td class="right"><?= $r['points'] ?></td>
  53. </table>
  54. </span>
  55. <?php
  56. }
  57. ?>
  58. </td>
  59. </tr>
  60. </table>
  61. </div>
  62. </main>
  63. <?php
  64. $infopage = ["", "Statistiques", ob_get_clean(), "", "stats","Stats de la semaine"]; //relativepath, pagetitle, pagecontent, pagescript | cf structure/template.php ligne 2 à 6
  65. include("structure/template.php");
  66. ?>