Guild Wars stat tracking The idea behind this is to track multiple characters individual stats as well as account stats.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 

75 lines
4.0 KiB

  1. <?php
  2. $pagetitle = "Account options";
  3. include_once ('header.php');
  4. if (isset($_SESSION['userid'])){
  5. if (!empty($_POST['useremail'])) {
  6. //this section contains code to update the users e-mail address
  7. include_once ('includes/update-email.php');
  8. }
  9. if (!empty($_POST['oldpass'])) {
  10. // this section contains code to update the users password after verifying the old password first
  11. include_once ('includes/update-password.php');
  12. }
  13. if (!empty($_POST['setacc'])) {
  14. //this section contains code to set the users preferred game account
  15. include_once ('includes/set-prefacc.php');
  16. }
  17. if (!empty($_POST['setchar'])) {
  18. //this section contains code to the users preferred character
  19. include_once ('includes/set-prefchar.php');
  20. }
  21. echo '<h3>Set preferred account & character, or change e-mail or password</h3>';
  22. // select which GW account you want to default to
  23. echo '<form action="preferences.php" method="post"><table border="1"><caption style="white-space: nowrap; overflow: hidden;">Current preferred account: <b>' .$_SESSION['prefaccname'] . '</b></caption>';
  24. echo '<tr><td><select name="prefaccid">';
  25. echo '<option value="nopref">Prefer no default</option>';
  26. $prefacc = $con->prepare("SELECT accid, accemail FROM gwaccounts WHERE userid = ?");
  27. $prefacc->bind_param("i", $_SESSION['userid']);
  28. $prefacc->execute();
  29. $resacc = $prefacc->get_result();
  30. while ($row = $resacc->fetch_assoc()) {
  31. echo '<option value="' . $row['accid'] . '">' . $row['accemail'] . '</option>';
  32. }
  33. echo '</td><td><input type="submit" value="Set account"></td></tr></select></table><input type="hidden" name="setacc" value="update"></form><br />';
  34. // select which character from your GW account you want to default to
  35. echo '<form action="preferences.php" method="post"><table border="1"><caption style="white-space: nowrap; overflow: hidden;">Current preferred character: <b>' .$_SESSION['prefcharname'] . '</b></caption>';
  36. echo '<tr><td><select name="prefcharid">';
  37. echo '<option value="nopref">Prefer no default</option>';
  38. $prefchar = $con->prepare("SELECT charid, charname FROM gwchars WHERE accid = ? AND userid = ?");
  39. $prefchar->bind_param("ii", $_SESSION['prefaccid'], $_SESSION['userid']);
  40. $prefchar->execute();
  41. $reschar = $prefchar->get_result();
  42. while ($row2 = $reschar->fetch_assoc()) {
  43. echo '<option value="' . $row2['charid'] . '">' . $row2['charname'] . '</option>';
  44. }
  45. echo '</td><td><input type="submit" value="Set character"></td></tr></select></table><input type="hidden" name="setchar" value="updatechar"></form><br />';
  46. // update e-mail address form
  47. echo '<form action="preferences.php" method="post"><table border="1">';
  48. echo '<caption>Update e-mail address</caption>';
  49. echo '<tr><td><input type="text" name="useremail" value="' . $_SESSION['usermail'] . '"></td><td><input type="submit" value="Update e-mail"></td></tr>';
  50. echo '</table></form><br /><br />';
  51. // update password form
  52. echo <<<UPDPASS
  53. <form action="preferences.php" method="post"><table border="1">
  54. <tr><th>Old Password</th><tr>
  55. <tr><td><input type="password" name="oldpass" required></td></tr>
  56. <tr><th>New password</th></tr>
  57. <tr><td><input type="password" required="required" name="userpass1" id="up1"></td></tr>
  58. <tr><th>Verify password</th></tr>
  59. <tr><td><input type="password" required="required" name="userpass2" id="up2"></td></tr>
  60. </table><script type="text/javascript">
  61. function Validate() {
  62. var userpass1 = document.getElementById("up1").value;
  63. var userpass2 = document.getElementById("up2").value;
  64. if (userpass1 != userpass2) {
  65. alert("Passwords do not match.");
  66. return false;
  67. }
  68. return true;
  69. }
  70. </script>
  71. <input type="submit" name="submission" value="Update password" onclick="return Validate()" id="btnSubmit"></form>
  72. UPDPASS;
  73. }
  74. include_once ('footer.php');
  75. ?>