Guild Wars stat tracking The idea behind this is to track multiple characters individual stats as well as account stats.
Вы не можете выбрать более 25 тем Темы должны начинаться с буквы или цифры, могут содержать дефисы(-) и должны содержать не более 35 символов.
 
 
 
 
 

91 строка
4.6 KiB

  1. <?php
  2. $pagetitle = "Add a Guild Wars account to track";
  3. include_once ('header.php');
  4. if (isset($_SESSION['userid'])) {
  5. //include_once ('includes/session-debug.php');
  6. //include_once ('includes/session-dump.php');
  7. if (!empty($_POST['prefcharid'])) {
  8. //this section contains code to the users preferred character
  9. include_once ('includes/set-prefchar.php');
  10. }
  11. if (!empty($_POST['prefaccid'])) {
  12. //this section contains code to set the users preferred game account
  13. include_once ('includes/set-prefacc.php');
  14. }
  15. if (!empty($_POST['accemail'])) {
  16. // this section contains the code to add a new game account to track
  17. include_once ('includes/addaccount-submit.php');
  18. }
  19. if (!empty($_POST['delcharid'])) {
  20. // this section contains code to delete the selected characters
  21. include_once ('includes/del-character.php');
  22. }
  23. if (!empty($_POST['newcharname'])) {
  24. // this section contains code to insert a new character into the database
  25. include_once ('includes/addcharacters-submit.php');
  26. }
  27. echo '<form action="addaccounts.php" method="post"><table>';
  28. echo '<caption>Add a new Guild Wars account e-mail or alias</caption>';
  29. echo '<tr><td><input type="text" name="accemail" size="35" required></td><td><input type="submit" value="Add account"></td></tr>';
  30. echo '</table></form><br />';
  31. echo '<table border="1"><caption style="white-space: nowrap; overflow: hidden;">Current Guild Wars accounts</caption>';
  32. echo '<tr><th>Account name</th><th>Preferred?</th></tr>';
  33. $acclist = $con->prepare("SELECT accid, accemail FROM gwaccounts WHERE userid = ?");
  34. $acclist->bind_param("i", $_SESSION['userid']);
  35. $acclist->execute();
  36. $result = $acclist->get_result();
  37. while ($row = $result->fetch_assoc()) {
  38. echo '<tr><td><form action="addaccounts.php" method="post"><input type="submit" class="submitLink" value="' . $row['accemail'] . '">';
  39. echo '</td><td><div class="radio"><input type="radio" name="prefaccid" value="'. $row['accid'] . '"';
  40. if ($row['accid'] == $_SESSION['prefaccid']) {
  41. echo ' checked';
  42. }
  43. echo '></div></td></tr>';
  44. }
  45. $acclist->close();
  46. echo '</form></table><br />';
  47. // add characters here
  48. echo '<form action="addaccounts.php" method="post"><table>';
  49. echo '<caption style="white-space: nowrap; overflow: hidden;">Add character to account: ' . $_SESSION['prefaccname'] . '</caption>';
  50. echo '<tr><th>Character name</th><th>Birthdate</th><th>Profession</th></tr>';
  51. echo '<tr><td><input type="text" name="newcharname" size="19" required autofocus></td><td><input type="date" name="bdate" placeholder="2005-04-28"></td><td><select name="profid" required>';
  52. // $gp = Get Profession
  53. $gp = $con->prepare("SELECT profid, profession FROM gwprofessions");
  54. $gp->execute();
  55. $result = $gp->get_result();
  56. while ($row = $result->fetch_assoc()) {
  57. echo '<option value=' . $row['profid'] . '>' . $row['profession'] . '</option>';
  58. }
  59. echo '</td></tr>';
  60. echo '<tr><td colspan="3"><input type="submit" value="Add character"></td></tr></table></form><br />';
  61. echo '<form action="addaccounts.php" method="post"><table border="1"><caption style="white-space: nowrap; overflow: hidden;">Available characters</caption>';
  62. echo '<tr><td>charid</td><td>accid</td><td>charname</td><td>Preferred</td><td>Delete?</td></tr>';
  63. $lc = $con->prepare("SELECT charid, accid, charname, profid, profcolor FROM gwchars WHERE accid = ?");
  64. $lc->bind_param("i", $_SESSION['prefaccid']);
  65. $lc->execute();
  66. $res2 = $lc->get_result();
  67. while ($row2 = $res2->fetch_assoc()) {
  68. echo '<tr><td><input type="text" readonly size="4" name="charid[]" value="' . $row2['charid'] . '"></td>';
  69. echo '<td><input type="text" readonly size="4" name="accid[]" value="' . $row2['accid'] . '"></td>';
  70. echo '<td style="background-color:' . ($row2['profcolor']) . '"><form action="addaccounts.php" method="post"><input type="submit" class="submitLink" value="' . $row2['charname'] . '"></td>';
  71. echo '<td><div class="radio"><input type="radio" name="prefcharid" value="' . $row2['charid'] . '"';
  72. if ($row2['charid'] == $_SESSION['prefcharid']) {
  73. echo ' checked';
  74. }
  75. echo '></div></td>';
  76. echo '<td><input type="checkbox" name="delcharid[]" value="' . $row2['charid'] . '"></td></tr>';
  77. }
  78. echo '</form></table><input type="submit" value="Modify selected characters"></form><br />';
  79. echo '<br />Return to your <a href="index.php" class="navlink">user</a> page';
  80. }
  81. include_once ('footer.php');
  82. ?>