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.
 
 
 
 
 

87 lines
3.9 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>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 'the session prefaccid is: ' . $_SESSION['prefaccid'] . '<br/>';
  36. echo 'the session userid is: ' .$_SESSION['userid'] . '<br/>';
  37. 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>';
  38. echo '<tr><td><select name="prefcharid">';
  39. echo '<option value="nopref">Prefer no default</option>';
  40. $prefchar = $con->prepare("SELECT charid, charname FROM gwchars WHERE accid = ? AND userid = ?");
  41. $prefchar->bind_param("ii", $_SESSION['prefaccid'], $_SESSION['userid']);
  42. $prefchar->execute();
  43. $reschar = $prefchar->get_result();
  44. while ($row2 = $reschar->fetch_assoc()) {
  45. echo '<option value="' . $row2['charid'] . '">' . $row2['charname'] . '</option>';
  46. }
  47. echo '</td><td><input type="submit" value="Set character"></td></tr></select></table><input type="hidden" name="setchar" value="updatechar"></form><br />';
  48. # needed code: select charrid from table gwchars selected by accid
  49. // update e-mail address form
  50. echo '<form action="preferences.php" method="post"><table border="1">';
  51. echo '<caption>Update e-mail address</caption>';
  52. echo '<tr><td><input type="text" name="useremail" value="' . $_SESSION['usermail'] . '"></td><td><input type="submit" value="Update e-mail"></td></tr>';
  53. echo '</table></form><br /><br />';
  54. // update password form
  55. echo <<<UPDPASS
  56. <form action="preferences.php" method="post"><table border="1">
  57. <tr><th>Old Password</th><tr>
  58. <tr><td><input type="password" name="oldpass" required></td></tr>
  59. <tr><th>New password</th></tr>
  60. <tr><td><input type="password" required="required" name="userpass1" id="up1"></td></tr>
  61. <tr><th>Verify password</th></tr>
  62. <tr><td><input type="password" required="required" name="userpass2" id="up2"></td></tr>
  63. </table><script type="text/javascript">
  64. function Validate() {
  65. var userpass1 = document.getElementById("up1").value;
  66. var userpass2 = document.getElementById("up2").value;
  67. if (userpass1 != userpass2) {
  68. alert("Passwords do not match.");
  69. return false;
  70. }
  71. return true;
  72. }
  73. </script>
  74. <input type="submit" name="submission" value="Update password" onclick="return Validate()" id="btnSubmit"></form>
  75. UPDPASS;
  76. }
  77. include_once ('footer.php');
  78. ?>