Guild Wars stat tracking The idea behind this is to track multiple characters individual stats as well as account stats.
您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符
 
 
 
 
 

50 行
2.3 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>Max Title %</th><th>Next Rank</th></tr>';
  8. // $gas = GetAccountStats
  9. $gas = $con->prepare("SELECT * FROM gwaccstats WHERE userid = ? AND accid = ? ORDER BY currentstrank DESC, percent ASC");
  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. if ($row['percent'] > 100) {
  38. $ohp = 100;
  39. } else {
  40. $ohp = $row['percent'];
  41. }
  42. echo '<tr><td style="width:150px;">' . $titlename . '</td><td style="width:200px;">' . $row['currentstrankname'] . '</td><td style="width:100px;">' . number_format($row['titlepoints']) . '</td><td style="width:70px;">' . $row['currentstrank'] . '</td>';
  43. echo '<td style="width:100px;">' . $pr . '</td><td><div class="percentbar" style="width:100px;"><div style="width:' . $ohp . 'px;"></div></div>';
  44. echo $ohp;
  45. echo '% completed</td><td>' . $stname . '</td></tr>';
  46. }
  47. $gas->close();
  48. echo '</table><br />';
  49. }
  50. ?>