Guild Wars stat tracking The idea behind this is to track multiple characters individual stats as well as account stats.
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.
 
 
 
 
 

43 lines
1.9 KiB

  1. <?php
  2. //include_once ('includes/session-debug.php');
  3. //include_once ('includes/session-dump.php');
  4. // remove the above 2 lines
  5. if (isset($_SESSION['userid'])) {
  6. echo '<table border="1"><caption>Account wide stats</caption>';
  7. echo '<tr><th>Title</th><th>Title Rank</th><th>Title Points</th><th>Current Rank</th><th>Points Remaining</th><th>Next Rank</th></tr>';
  8. // $gas = GetAccountStats
  9. $gas = $con->prepare("SELECT * FROM gwaccstats WHERE userid = ? AND accid = ?");
  10. $gas->bind_param("ii", $_SESSION['userid'], $_SESSION['prefaccid']);
  11. $gas->execute();
  12. $result = $gas->get_result();
  13. while ($row = $result->fetch_assoc()) {
  14. // $gnr = Get Next Rank
  15. $gnr = $con->prepare("SELECT stpoints, stname FROM gwsubtitles WHERE titlenameid = ? AND stpoints >= ? ORDER BY stpoints ASC LIMIT 1");
  16. $gnr->bind_param("ii", $row['titlenameid'], $row['titlepoints']);
  17. $gnr->execute();
  18. $gnr->bind_result($stpoints, $stname);
  19. $gnr->fetch();
  20. $gnr->close();
  21. // $gt = Get Title
  22. $gt = $con->prepare("SELECT titlename FROM gwtitles WHERE titlenameid = ?");
  23. $gt->bind_param("i", $row['titlenameid']);
  24. $gt->execute();
  25. $gt->bind_result($titlename);
  26. $gt->fetch();
  27. $gt->close();
  28. $pr = number_format(($stpoints - $row['titlepoints']));
  29. if ($pr < 0) {
  30. $pr = "Highest rank achieved!";
  31. $stname = "Highest rank achieved!";
  32. }
  33. if ($row['currentstrankname'] === NULL) {
  34. $row['currentstrankname'] = "No title earned yet!";
  35. $row['currentstrank'] = "0";
  36. }
  37. echo '<tr><td>' . $titlename . '</td><td>' . $row['currentstrankname'] . '</td><td>' . number_format($row['titlepoints']) . '</td><td>' . $row['currentstrank'] . '</td>';
  38. echo '<td>' . $pr . '</td><td>' . $stname . '</td></tr>';
  39. }
  40. $gas->close();
  41. echo '</table><br />';
  42. }
  43. ?>