Guild Wars stat tracking The idea behind this is to track multiple characters individual stats as well as account stats.
選択できるのは25トピックまでです。 トピックは、先頭が英数字で、英数字とダッシュ('-')を使用した35文字以内のものにしてください。
 
 
 
 
 

68 行
2.6 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. if (!empty($_POST['delchar'])) {
  14. echo 'removing selected character(s) from selected account<br />';
  15. $delchar = $con->prepare("DELETE FROM gwchars WHERE charid = ? AND accid = ? AND userid = ?");
  16. $delchar->bind_param("iii", $_POST['charid'], $_POST['accid'], $_SESSION['userid']);
  17. $delchar->execute();
  18. $delchar->close();
  19. echo 'Need to figure out code to delete stats related to this character still!<br />';
  20. //header ("Refresh:1; url=addacounts.php");
  21. //exit();
  22. }
  23. echo '<form action="addaccounts.php" method="post"><table>';
  24. echo '<caption>Add a new Guild Wars account e-mail or alias</caption>';
  25. echo '<tr><td><input type="text" name="accemail" size="35" required></td><td><input type="submit" value="Add account"></td></tr>';
  26. echo '</table></form><br />';
  27. echo '<table border="1"><caption style="white-space: nowrap; overflow: hidden;">Current Guild Wars accounts</caption>';
  28. echo '<tr><th>Account name</th></tr>';
  29. // grab account name from database and loop it in here as a read only bit
  30. $acclist = $con->prepare("SELECT accid, accemail FROM gwaccounts WHERE userid = ?");
  31. $acclist->bind_param("i", $_SESSION['userid']);
  32. $acclist->execute();
  33. $result = $acclist->get_result();
  34. while ($row = $result->fetch_assoc()) {
  35. echo '<tr><td>';
  36. if ($row['accid'] == $_SESSION['prefaccid']) {
  37. echo '<b>' . $row['accemail'] . '</b>';
  38. } else {
  39. echo $row['accemail'];
  40. }
  41. echo '</td></tr>';
  42. }
  43. $acclist->close();
  44. echo '</table><br />';
  45. echo '<form action="addaccount.php" method="post"><table border="1"><caption style="white-space: nowrap; overflow: hidden;">Available characters</caption>';
  46. echo '<tr><td>charid</td><td>charname</td><td>Delete?</td></tr>';
  47. $lc = $con->prepare("SELECT charid, charname FROM gwchars WHERE accid = ?");
  48. $lc->bind_param("i", $_SESSION['prefaccid']);
  49. $lc->execute();
  50. $res2 = $lc->get_result();
  51. while ($row2 = $res2->fetch_assoc()) {
  52. echo '<tr><td>' . $row2['charid'] . '</td><td>';
  53. if ($row2['charid'] == $_SESSION['prefcharid']) {
  54. echo '<b>' . $row2['charname'] . '</b>';
  55. } else {
  56. echo $row2['charname'];
  57. }
  58. echo '</td><td><input type="checkbox" name="delchar" value="yes"></td></tr>';
  59. }
  60. echo '</table>';
  61. echo '<br />Return to your <a href="index.php" class="navlink">user</a> page';
  62. include_once ('footer.php');
  63. ?>