Guild Wars stat tracking The idea behind this is to track multiple characters individual stats as well as account stats.
Nelze vybrat více než 25 témat Téma musí začínat písmenem nebo číslem, může obsahovat pomlčky („-“) a může být dlouhé až 35 znaků.
 
 
 
 
 

67 řádky
3.0 KiB

  1. <?php
  2. # delete this block when shit finally works.
  3. ini_set('display_errors', 'on');
  4. error_reporting(E_ALL);
  5. mysqli_report(MYSQLI_REPORT_ERROR | MYSQLI_REPORT_STRICT);
  6. # delete the above when shit finally works
  7. # use "$_POST['tid']" to show title ranks already associated with the selected title
  8. # and above that list put the input boxes for text and number_format
  9. # investigate if we can put multiple input boxes and loop through them to insert into the database
  10. # https://stackoverflow.com/questions/34469482/how-to-insert-multiple-inputs-into-the-database-using-the-power-of-php
  11. if (isset($_SESSION['tid'])) {
  12. $_POST['tid'] = $_SESSION['tid'];
  13. }
  14. if (isset($_SESSION['tr'])) {
  15. $tr = $_SESSION['tr'] + 1;
  16. } else {
  17. $trank = $con->prepare("SELECT MAX(strank) FROM gwsubtitles WHERE titlenameid = ?");
  18. $trank->bind_param("i", $_POST['tid']);
  19. $trank->execute();
  20. $trank->store_result();
  21. $trank->bind_result($gwstmr);
  22. while ($trank->fetch()) {
  23. if (is_null($gwstmr)) {
  24. $tr = 1;
  25. } else {
  26. $tr = $gwstmr;
  27. echo 'variable tr is set to: ' . $tr . '<br />';
  28. }
  29. }
  30. }
  31. $stmtname = $con->prepare("SELECT titlename, titlemaxrank FROM gwtitles WHERE titlenameid = ?");
  32. $stmtname->bind_param("i", $_POST['tid']);
  33. $stmtname->execute();
  34. $stmtname->store_result();
  35. $stmtname->bind_result($gwtn, $gwtmr);
  36. while ($stmtname->fetch()) {
  37. echo 'Adding rank to title <b>' . $gwtn . '</b><br />The maximum rank achievable in game is ' . $gwtmr . '<br />';
  38. }
  39. $stmtname->free_result();
  40. $stmtname->close();
  41. echo '<form action="titlemanager.php" method="post"><table border="1"><tr><th>Title Rank Name</th><th>Title Points</th><th>Rank Level</th></tr>';
  42. echo '<tr><td><input type="text" name="titlerankname" required autofocus></td><td><input type="number" name="titlepoints" required></td><td><input type="number" name="titlerank" min="1" max="15" value="' . $tr . '"></tr>';
  43. echo '</table><br /><input type="hidden" name="title" value="titleranksubmit"><input type="hidden" name="titlenameid" value="' . $_POST['tid'] . '"><input type="submit" value="Add title rank ..."></form>';
  44. echo 'Here are the currently associated title ranks, starting with rank 1:<br />';
  45. echo '<table border="1"><tr><th>stnameid</th><th>titlenameid</th><th>stname</th><th>stpoints</th><th>strank</th></tr>';
  46. $stmtview = $con->prepare("SELECT * FROM gwsubtitles WHERE titlenameid = ? ORDER BY strank ASC");
  47. $stmtview->bind_param("i", $_POST['tid']);
  48. $stmtview->execute();
  49. $result = $stmtview->get_result();
  50. while ($row = $result->fetch_assoc()) {
  51. $stnid = $row['stnameid'];
  52. $tnid = $row['titlenameid'];
  53. $stname = $row['stname'];
  54. $stpoints = $row['stpoints'];
  55. $strank = $row['strank'];
  56. echo '<tr><td>' . $stnid . '<td>' . $tnid . '</td><td>' . $stname . '</td><td>' . number_format($stpoints) . '</td><td>' . $strank . '</td></tr>';
  57. }
  58. $stmtview->close();
  59. echo '</table><br />If anything looks off, please fix it!<br /><br />';
  60. echo 'Return to <a href="titlemanager.php" class="navlink">title manager</a>'; //this line needs to go away soon. Maybe?
  61. ?>