Guild Wars stat tracking The idea behind this is to track multiple characters individual stats as well as account stats.
Você não pode selecionar mais de 25 tópicos Os tópicos devem começar com uma letra ou um número, podem incluir traços ('-') e podem ter até 35 caracteres.
 
 
 
 
 

85 linhas
4.9 KiB

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