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
3.5 KiB

  1. <?php
  2. $pagetitle = "Title Editor";
  3. include_once ('header.php');
  4. include_once ('connect.php');
  5. $con = mysqli_connect(DATABASE_HOST, DATABASE_USER, DATABASE_PASS, DATABASE_NAME);
  6. if ($con->connect_errno){
  7. die ('Unable to connect to database [' . $db->connect_errno . ']');
  8. }
  9. if ($_SESSION['title'] == "repeat") {
  10. $_POST['title'] = "addsubtitle";
  11. unset($_SESSION['title']);
  12. } else {
  13. unset($_SESSION['tr']);
  14. }
  15. if ($_SESSION['admin'] == 1) {
  16. echo '<br />';
  17. if ($_POST['title'] == "addtitle") {
  18. // included file contains all the code to add a new title
  19. include_once ('includes/title-add.php');
  20. } else if ($_POST['title'] == "titlesubmit") {
  21. // included file contains all the code to submit a new title
  22. include_once ('includes/title-submit.php');
  23. } else if ($_POST['title'] == "modtitle") {
  24. // included file contains all the code to edit a title
  25. include_once ('includes/title-editor.php');
  26. } else if ($_POST['title'] == "updatetitle") {
  27. // this section doesn't require human interaction
  28. include_once ('includes/title-update.php');
  29. } else if ($_POST['title'] == "addsubtitle") {
  30. // included file contains all code to add the title ranks and points required
  31. include_once ('includes/titleranks-add.php');
  32. } else if ($_POST['title'] == "titleranksubmit") {
  33. // this section doesn't require human interaction
  34. include_once ('includes/titleranks-submit.php');
  35. } else if ($_POST['title'] == "modsubtitle") {
  36. // included file contains all code to edit a title rank
  37. include_once ('includes/titleranks-editor.php');
  38. } else {
  39. unset($_SESSION['tid']);
  40. echo 'Add titles <form action="titlemanager.php" method="post"><input type="hidden" name="title" value="addtitle"><input type="submit" value="Add title"></form><br />';
  41. echo 'Modify titles <form action="titlemanager.php" method="post"><input type="hidden" name="title" value="modtitle"><select name="tid" onchange="this.form.submit()"><option selected disabled>Select title</option>';
  42. include ('includes/title-select.php');
  43. echo '</select><noscript><input type="submit" value="Modify Title"></noscript></form><br /><br />';
  44. echo 'Add title ranks and points to <form action="titlemanager.php" method="post"><input type="hidden" name="title" value="addsubtitle"><select name="tid" onchange="this.form.submit()"><option selected disabled>Add title rank(s)</option>';
  45. include ('includes/title-select.php');
  46. echo '</select><noscript><input type="submit" value="Add title rank"></noscript></form><br /><br />';
  47. // now to view the last 5 title entries in the database
  48. echo 'Here is the last 5 titles entered into the database, newest entry is on top:<br />';
  49. echo '<table border="1"><tr><th>titleid</th><th>titlename</th><th>titletype</th><th>titletype</th></tr>';
  50. $stmtview = $con->prepare("SELECT * FROM gwtitles ORDER BY titlenameid DESC LIMIT 5");
  51. $stmtview->execute();
  52. $result = $stmtview->get_result();
  53. while ($row = $result->fetch_assoc()) {
  54. $tid = $row['titlenameid'];
  55. $tname = $row['titlename'];
  56. $ttype = $row['titletype'];
  57. $tmr = $row['titlemaxrank'];
  58. echo '<tr><td>' . $tid . '</td><td>' . $tname . ' (' . $tmr . ')</td><td>' . $ttype . '</td><td>';
  59. if ($ttype == "0") {
  60. echo 'account';
  61. } else if ($ttype == "1") {
  62. echo 'character';
  63. } else {
  64. echo 'Anything other than a 0 or 1 means something broke!';
  65. include_once ('footer.php');
  66. exit();
  67. }
  68. echo '</td></tr>';
  69. }
  70. $stmtview->close();
  71. echo '</table><br />If anything looks off, please fix it!<br /><br />';
  72. }
  73. }
  74. include_once ('footer.php');
  75. ?>