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.
 
 
 
 
 

62 lines
2.1 KiB

  1. <?php
  2. $pagetitle = "Add a Guild Wars account to track";
  3. include_once ('header.php');
  4. if (!empty($_POST['accemail'])) {
  5. $addacc = $con->prepare("INSERT INTO gwaccounts (userid, accemail) VALUES (?, ?)");
  6. $addacc->bind_param("is", $_SESSION['userid'], $_POST['accemail']);
  7. $addacc->execute();
  8. $addacc->close();
  9. echo 'New account added, returning to editor.';
  10. header ("Refresh:1; url=addaccounts.php");
  11. exit();
  12. }
  13. echo '<form action="addaccounts.php" method="post"><table>';
  14. echo '<caption>Add a new Guild Wars account e-mail</caption>';
  15. echo '<tr><td><input type="text" name="accemail" size="35" autofocus required></td></tr>';
  16. echo '</table><input type="submit" value="Add account"></form><br /><br />';
  17. echo '<table border="1"><caption style="white-space: nowrap; overflow: hidden;">Current Guild Wars accounts</caption>';
  18. echo '<tr><th>Account name</th></tr>';
  19. // grab account name from database and loop it in here as a read only bit
  20. $acclist = $con->prepare("SELECT accid, accemail FROM gwaccounts WHERE userid = ?");
  21. $acclist->bind_param("i", $_SESSION['userid']);
  22. $acclist->execute();
  23. $result = $acclist->get_result();
  24. while ($row = $result->fetch_assoc()) {
  25. echo '<tr><td>';
  26. if ($row['accid'] == $_SESSION['prefaccid']) {
  27. echo '<b>' . $row['accemail'] . '</b>';
  28. } else {
  29. echo $row['accemail'];
  30. }
  31. echo '</td></tr>';
  32. }
  33. $acclist->close();
  34. echo '</table><br />';
  35. echo '<table border ="1"><caption style="white-space: nowrap; overflow: hidden;">Available characters</caption>';
  36. $lc = $con->prepare("SELECT charid, charname FROM gwchars WHERE accid = ?");
  37. $lc->bind_param("i", $_SESSION['prefaccid']);
  38. $lc->execute();
  39. $res2 = $lc->get_result();
  40. while ($row2 = $res2->fetch_assoc()) {
  41. echo '<tr><td>';
  42. if ($row2['charid'] == $_SESSION['prefcharid']) {
  43. echo '<b>' . $row2['charname'] . '</b>';
  44. } else {
  45. echo $row2['charname'];
  46. }
  47. echo '</td></tr>';
  48. }
  49. /*} else {
  50. echo '<tr><td>' . count($row2) . ' results!</td></tr>';
  51. echo '<tr><td>No characters found!</td></tr>';
  52. }*/
  53. echo '</table>';
  54. echo '<br />Return to your <a href="index.php" class="navlink">user</a> page';
  55. include_once ('footer.php');
  56. ?>