Just a web script to help track when, where, and what you got from the free treasures scattered about Nightfall in the game Guild Wars.
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.
 
 
 

101 rivejä
4.1 KiB

  1. <TITLE>What Dropped?</TITLE>
  2. <?php
  3. include_once 'gw-connect.php';
  4. $con = new mysqli(DATABASE_HOST, DATABASE_USER, DATABASE_PASS, DATABASE_NAME);
  5. #$toonid = mysqli_real_escape_string($con, $_POST['playerid']); //enable this after character selection is working
  6. $toonid = 'Chrissi Chan';
  7. #$location = mysqli_real_escape_string($con, $_POST['locationid']); //enable this after location selection is working
  8. $location = 4;
  9. $whatdropped = mysqli_real_escape_string($con, $_POST['gwdrop']);
  10. if ($con->connect_errno > 0){
  11. die ('Unable to connect to database [' . $db->connect_errno . ']');
  12. }
  13. echo '<FORM METHOD="POST" ACTION="gw-insert.php">';
  14. echo 'At ';
  15. $sqlmaplocation = "SELECT `location`, `wikilink` FROM `treasurelocation` WHERE `treasureid` = $location";
  16. if (!$result = $con->query($sqlmaplocation)){
  17. die ('There was an error running the query [' . $con->error . ']');
  18. }
  19. while ($row = $result->fetch_array()){
  20. $locname = $row['location'];
  21. $loclink = $row['wikilink'];
  22. echo '<A HREF="' . $loclink . '">' . $locname . '</A>';
  23. }
  24. echo ' a ';
  25. if ($whatdropped == "1"){
  26. //code for white blue purple etc
  27. $sqlweaprare = "SELECT * FROM `listrarity` ORDER BY `rareid` ASC";
  28. if (!$result = $con->query($sqlweaprare)){
  29. die ('There was an error running the query [' . $con->error . ']');
  30. }
  31. echo '<SELECT NAME="rare">';
  32. while ($row = $result->fetch_array()){
  33. $rareid = $row['rareid'];
  34. $rarity = $row['rarity'];
  35. echo '<OPTION VALUE="' . $rareid . '">' . $rarity . '</OPTION>';
  36. }
  37. echo '</SELECT>, ';
  38. //code for weapon attribute requirment
  39. $sqlweapreq = "SELECT * FROM `listreq` ORDER BY `req` ASC";
  40. if (!$result = $con->query($sqlweapreq)){
  41. die ('There was an error running the query [' . $con->error . ']');
  42. }
  43. echo 'req<SELECT NAME="requirement">';
  44. while ($row = $result->fetch_array()){
  45. $reqid = $row['req'];
  46. echo '<OPTION VALUE="' . $reqid . '">' . $reqid . '</OPTION>';
  47. }
  48. echo '</SELECT>';
  49. //code for what attribute the weapon is (command, axe mastery, energy storage, etc
  50. $sqlweapattr = "SELECT * FROM `listattribute` ORDER BY `weapattrid` ASC";
  51. if (!$result = $con->query($sqlweapattr)){
  52. die ('There was an error running the query [' . $con->error . ']');
  53. }
  54. echo '<SELECT NAME="attribute">';
  55. while ($row = $result->fetch_array()){
  56. $attrid = $row['weapattrid'];
  57. $weapattr = $row['weaponattribute'];
  58. echo '<OPTION VALUE="' . $attrid . '">' . $weapattr . '</OPTION>';
  59. //need to add a nested while loop, to preselect the weapon with the attribute, or somehow java it? An r9 Axe of Energy Storage combo doesn't exist.
  60. }
  61. echo '</SELECT>';
  62. //code for what the weapon is - staff, dagger, scythe, wand, sword, etc
  63. $sqlweaptype = "SELECT * FROM `listtype` ORDER BY `weaponid` ASC";
  64. if (!$result = $con->query($sqlweaptype)){
  65. die ('There was an error running the query [' . $con->error . ']');
  66. }
  67. echo '<SELECT NAME="weapon">';
  68. while ($row = $result->fetch_array()){
  69. $typeid = $row['weaponid'];
  70. $weapon = $row['weapontype'];
  71. echo '<OPTION VALUE="' . $typeid . '">' . $weapon . '</OPTION>';
  72. }
  73. echo '</SELECT>';
  74. } else if ($whatdropped == "2"){
  75. //code for what rare material dropped
  76. $sqlraremat = "SELECT * FROM `materials` ORDER BY `materialid` ASC";
  77. if (!$result = $con->query($sqlraremat)){
  78. die ('There was an error running the query [' . $con->error . ']');
  79. }
  80. echo '<SELECT NAME="rarematerial">';
  81. while ($row = $result->fetch_array()){
  82. $matid = $row['materialid'];
  83. $raremat = $row['material'];
  84. echo '<OPTION VALUE="' . $matid . '">' . $raremat . '</OPTION>';
  85. }
  86. echo '</SELECT> ';
  87. echo ' and |code for gold dropped here| gold pieces';
  88. echo ' <BR /><CENTER><INPUT TYPE="SUBMIT" VALUE="Click me!"></FORM></CENTER><BR />';
  89. } else if ($whatdropped == "3"){
  90. echo 'run rune code';
  91. } else {
  92. echo '<FORM METHOD="POST"><SELECT NAME="gwdrop" onchange="this.form.submit()">';
  93. echo '<OPTION SELECTED DISABLED>choose one</OPTION>';
  94. echo '<OPTION VALUE="1">weapon</OPTION>';
  95. echo '<OPTION VALUE="2">material</OPTION>';
  96. echo '<OPTION VALUE="3">rune</OPTION></SELECT>';
  97. echo '<NOSCRIPT><INPUT TYPE="SUBMIT" VALUE="SUBMIT"></NOSCRIPT></FORM>';
  98. exit;
  99. }
  100. echo 'Reload the page with no GET data? <A HREF="gw-record.php">RELOAD</A>';
  101. ?>