Guild Wars stat tracking The idea behind this is to track multiple characters individual stats as well as account stats.
25'ten fazla konu seçemezsiniz Konular bir harf veya rakamla başlamalı, kısa çizgiler ('-') içerebilir ve en fazla 35 karakter uzunluğunda olabilir.
 
 
 
 
 

69 satır
3.2 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. unset($_SESSION['title']);
  12. if (isset($_SESSION['tid'])) {
  13. $_POST['tid'] = $_SESSION['tid'];
  14. }
  15. if (isset($_SESSION['tr'])) {
  16. $tr = $_SESSION['tr'] + 1;
  17. } else {
  18. $trank = $con->prepare("SELECT MAX(strank) FROM gwsubtitles WHERE titlenameid = ?");
  19. $trank->bind_param("i", $_POST['tid']);
  20. $trank->execute();
  21. $trank->store_result();
  22. $trank->bind_result($gwstmr);
  23. while ($trank->fetch()) {
  24. if (is_null($gwstmr)) {
  25. $tr = 1;
  26. } else {
  27. $tr = $gwstmr + 1;
  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" readonly 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 '<form action="titlemanager.php" method="post"><table border="1"><tr><th>stnameid</th><th>titlenameid</th><th>stname</th><th>stpoints</th><th>strank</th><th>Edit</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><td><input type="checkbox" name="editstitle[]" value="' . $stnid . '"></td></tr>';
  57. }
  58. $stmtview->close();
  59. $_SESSION['tid'] = $_POST['tid'];
  60. echo '</table><br /><input type="hidden" name="title" value="modsubtitle"><input type="submit" value="Edit selected titles"></form><br />If anything looks off, please fix it!<br /><br />';
  61. echo 'Return to <a href="titlemanager.php" class="navlink">title manager</a>';
  62. ?>