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.

90 lines
3.5 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, $_GET['gwdrop']);
  10. if ($con->connect_errno > 0){
  11. die ('Unable to connect to database [' . $db->connect_errno . ']');
  12. }
  13. echo 'At ';
  14. $sqlmaplocation = "SELECT `location`, `wikilink` FROM `treasurelocation` WHERE `treasureid` = $location";
  15. if (!$result = $con->query($sqlmaplocation)){
  16. die ('There was an error running the query [' . $con->error . ']');
  17. }
  18. while ($row = $result->fetch_array()){
  19. $locname = $row['location'];
  20. $loclink = $row['wikilink'];
  21. echo '<A HREF="' . $loclink . '">' . $locname . '</A>';
  22. }
  23. echo ' a ';
  24. #experimental stuff
  25. echo '<FORM><SELECT NAME="gwdrop" onchange="this.form.submit()">';
  26. echo '<OPTION VALUE="1">weapon</OPTION>';
  27. echo '<OPTION VALUE="2">material</OPTION>';
  28. echo '<OPTION VALUE="3">rune</OPTION></SELECT>';
  29. echo '<NOSCRIPT><INPUT TYPE="SUBMIT" VALUE="SUBMIT"></NOSCRIPT></FORM>';
  30. echo '<BR /><BR />Current drop value is: ' . $whatdropped . '</BR /><BR />'; //if this works then it's time to make a big as if else statement
  31. //code for white blue purple etc
  32. $sqlweaprare = "SELECT * FROM `listrarity` ORDER BY `rareid` ASC";
  33. if (!$result = $con->query($sqlweaprare)){
  34. die ('There was an error running the query [' . $con->error . ']');
  35. }
  36. echo '<SELECT NAME="rare">';
  37. while ($row = $result->fetch_array()){
  38. $rareid = $row['rareid'];
  39. $rarity = $row['rarity'];
  40. echo '<OPTION VALUE="' . $rareid . '">' . $rarity . '</OPTION>';
  41. }
  42. echo '</SELECT>, ';
  43. //code for weapon attribute requirment
  44. $sqlweapreq = "SELECT * FROM `listreq` ORDER BY `req` ASC";
  45. if (!$result = $con->query($sqlweapreq)){
  46. die ('There was an error running the query [' . $con->error . ']');
  47. }
  48. echo 'req<SELECT NAME="requirement">';
  49. while ($row = $result->fetch_array()){
  50. $reqid = $row['req'];
  51. echo '<OPTION VALUE="' . $reqid . '">' . $reqid . '</OPTION>';
  52. }
  53. echo '</SELECT>';
  54. //code for what attribute the weapon is (command, axe mastery, energy storage, etc
  55. $sqlweapattr = "SELECT * FROM `listattribute` ORDER BY `weapattrid` ASC";
  56. if (!$result = $con->query($sqlweapattr)){
  57. die ('There was an error running the query [' . $con->error . ']');
  58. }
  59. echo '<SELECT NAME="attribute">';
  60. while ($row = $result->fetch_array()){
  61. $attrid = $row['weapattrid'];
  62. $weapattr = $row['weaponattribute'];
  63. echo '<OPTION VALUE="' . $attrid . '">' . $weapattr . '</OPTION>';
  64. //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.
  65. }
  66. echo '</SELECT>';
  67. //code for what the weapon is - staff, dagger, scythe, wand, sword, etc
  68. $sqlweaptype = "SELECT * FROM `listtype` ORDER BY `weaponid` ASC";
  69. if (!$result = $con->query($sqlweaptype)){
  70. die ('There was an error running the query [' . $con->error . ']');
  71. }
  72. echo '<SELECT NAME="weapon">';
  73. while ($row = $result->fetch_array()){
  74. $typeid = $row['weaponid'];
  75. $weapon = $row['weapontype'];
  76. echo '<OPTION VALUE="' . $typeid . '">' . $weapon . '</OPTION>';
  77. //need to figure out how to display the options for weapon, material, or rune
  78. }
  79. echo '</SELECT>';
  80. echo ' and |code for gold dropped here| gold pieces';
  81. echo ' <BR /><BR />';
  82. echo 'End result: a Gold r9 Swordsmanship Sword'; //need to arrange code blocks around to achieve this
  83. ?>