Advertisement
whitestarrr

Untitled

Nov 28th, 2016
70
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.26 KB | None | 0 0
  1. <!DOCTYPE html>
  2. <html lang="en" xmlns="http://www.w3.org/1999/html">
  3. <head>
  4. <link rel="stylesheet" href="styles/headerAndFooter.css">
  5. <link rel="stylesheet" href="styles/profile.css">
  6. <link rel="stylesheet" href="styles/sidebar.css">
  7. <link rel="stylesheet" href="styles/main.css">
  8.  
  9. <meta charset="UTF-8">
  10. <title>Profile</title>
  11. </head>
  12. </head>
  13. <body>
  14.  
  15. <?php include_once('header.php'); ?>
  16.  
  17. <div class="wrapper">
  18. <div class="username" >
  19. <h2 align="center"><?=$_SESSION['username']?></h2>
  20. </div>
  21.  
  22. <div class="profile-pic" align="center">
  23. <img src="images/footer_github.png" alt="Profile picture" class="profile">
  24. </div>
  25.  
  26. <table class="profileinfo" cellpadding="40" cellspacing="20" style="margin: 40px auto;">
  27. <tr>
  28. <th>First Name</th>
  29. <th>Last Name</th>
  30. <th>Score</th>
  31. <th>Ranking</th>
  32. </tr>
  33. <?php
  34. $user = $_SESSION ['username'];
  35. $sql = "SELECT * FROM users WHERE nickname = '$user'";
  36. $query = mysqli_query($connect, $sql);
  37. $row = $query->fetch_assoc();
  38. echo '<tr>
  39. <td>
  40. <h4>' . $row['first_name'] . '</h4>
  41. </td>
  42. <td>
  43. <h4>' . $row['last_name'] . '</h4>
  44. </td>
  45. <td>
  46. <h4>' . $row['xp'] . '</h4>
  47. </td>
  48. <td>
  49. <h4>' . '#' . $row['rank'] . '</h4>
  50. </td>
  51. </tr>';
  52. ?>
  53.  
  54. </table>
  55.  
  56. <div class="text">
  57. <p>This is information about me</p>
  58. </div>
  59.  
  60. <div class="match-history">
  61. <h2 class="desc">Match History</h2>
  62. </div>
  63.  
  64. <div class="table-history">
  65. <table class="match-history-table">
  66. <tr>
  67. <th></th>
  68. <th>Username:</th>
  69. <th>Result:</th>
  70. <th></th>
  71. <th>Against:</th>
  72. <th>Gained XP:</th>
  73. <th>Date:</th>
  74. </tr>
  75. <tr>
  76. <?php
  77. $userid = $_SESSION ['userid'];
  78. $sql = "SELECT * FROM battle_log WHERE user1_id = '$userid' || user2_id = '$userid' ORDER BY date DESC";
  79. $query = mysqli_query($connect, $sql);
  80. while($row = $query->fetch_assoc()) {
  81. if ($row['user1_id'] == $userid) {
  82. $opponentid = $row['user2_id'];
  83. }
  84. else {
  85. $opponentid = $row['user1_id'];
  86. }
  87.  
  88. if ($row['winner'] == $userid) {
  89. $result = 'Victory';
  90. } else {
  91. $result = 'Defeat';
  92. }
  93. $opponent = mysqli_query($connect, "SELECT * FROM users WHERE id = '$opponentid'")->fetch_assoc()['nickname'];
  94.  
  95. echo '<tr class="match">
  96. <td><img src="images/footer_github.png" height="20"></td>
  97. <td>' . $user . '</td>
  98. <td>' . $result . '</td>
  99. <td><img src="images/footer_github.png" height="20" </td>
  100. <td>' . $opponent . '</td>
  101. <td>' . $row['won_xp'] . '</td>
  102. <td>' . $row['date'] . '</td>
  103. </tr>
  104. ';
  105. }
  106.  
  107. ?>
  108. </tr>
  109. <script>
  110. var matches = document.getElementsByClassName("match");
  111. for (row of matches) {
  112. document.getElementsByClassName("match").style.backgroundColor = "blue";
  113. }
  114. </script>
  115. </table>
  116. </div>
  117. </div>
  118.  
  119. <?php include_once('footer.html'); ?>
  120. </body>
  121. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement