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.
您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符
 
 
 

123 行
5.6 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 = '3'; //delete this line after character selection is finished/working
  7. #$location = mysqli_real_escape_string($con, $_POST['locationid']); //enable this after location selection is working
  8. $location = 4; //delete this line after location selection is finished/working
  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 'At ';
  14. $sqlmaplocation = "SELECT * 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. $locid = $row['treasureid'];
  22. echo '<A HREF="' . $loclink . '">' . $locname . '</A>';
  23. }
  24. echo ' a ';
  25. if ($whatdropped == "1"){
  26. echo '<FORM METHOD="POST" ACTION="gw-insert.php">';
  27. echo 'on <INPUT NAME="treasuredate" TYPE="DATETIME-LOCAL"> ';
  28. //code for white blue purple etc
  29. $sqlweaprare = "SELECT * FROM `listrarity` ORDER BY `rareid` ASC";
  30. if (!$result = $con->query($sqlweaprare)){
  31. die ('There was an error running the query [' . $con->error . ']');
  32. }
  33. echo '<SELECT NAME="rare">';
  34. while ($row = $result->fetch_array()){
  35. $rareid = $row['rareid'];
  36. $rarity = $row['rarity'];
  37. echo '<OPTION VALUE="' . $rareid . '">' . $rarity . '</OPTION>';
  38. }
  39. echo '</SELECT>, ';
  40. //code for weapon attribute requirment
  41. $sqlweapreq = "SELECT * FROM `listreq` ORDER BY `req` ASC";
  42. if (!$result = $con->query($sqlweapreq)){
  43. die ('There was an error running the query [' . $con->error . ']');
  44. }
  45. echo 'req<SELECT NAME="requirement">';
  46. while ($row = $result->fetch_array()){
  47. $reqid = $row['req'];
  48. echo '<OPTION VALUE="' . $reqid . '">' . $reqid . '</OPTION>';
  49. }
  50. echo '</SELECT>';
  51. //code for what attribute the weapon is (command, axe mastery, energy storage, etc
  52. $sqlweapattr = "SELECT * FROM `listattribute` ORDER BY `weapattrid` ASC";
  53. if (!$result = $con->query($sqlweapattr)){
  54. die ('There was an error running the query [' . $con->error . ']');
  55. }
  56. echo '<SELECT NAME="attribute">';
  57. while ($row = $result->fetch_array()){
  58. $attrid = $row['weapattrid'];
  59. $weapattr = $row['weaponattribute'];
  60. echo '<OPTION VALUE="' . $attrid . '">' . $weapattr . '</OPTION>';
  61. //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.
  62. }
  63. echo '</SELECT>';
  64. //code for what the weapon is - staff, dagger, scythe, wand, sword, etc
  65. $sqlweaptype = "SELECT * FROM `listtype` ORDER BY `weaponid` ASC";
  66. if (!$result = $con->query($sqlweaptype)){
  67. die ('There was an error running the query [' . $con->error . ']');
  68. }
  69. echo '<SELECT NAME="weapon">';
  70. while ($row = $result->fetch_array()){
  71. $typeid = $row['weaponid'];
  72. $weapon = $row['weapontype'];
  73. echo '<OPTION VALUE="' . $typeid . '">' . $weapon . '</OPTION>';
  74. }
  75. echo '</SELECT> called the <INPUT TYPE="TEXT" NAME="itemname" MAXLENGTH="100" SIZE="40">';
  76. echo ' and <INPUT TYPE="NUMBER" NAME="droppedgold" SIZE="4" MIN="1" MAX="9999"> gold pieces.';
  77. echo '<INPUT TYPE="HIDDEN" NAME="droptype" VALUE="1"><INPUT TYPE="HIDDEN" NAME="location" VALUE="' . $locid .'">';
  78. echo '<INPUT TYPE="HIDDEN" NAME="chartoon" VALUE="' . $toonid .'">';
  79. echo ' <BR /><CENTER><INPUT TYPE="SUBMIT" VALUE="Click me!"></FORM></CENTER><BR />';
  80. } else if ($whatdropped == "2"){
  81. echo '<FORM METHOD="POST" ACTION="gw-insert.php">';
  82. //code for what rare material dropped
  83. $sqlraremat = "SELECT * FROM `materials` ORDER BY `materialid` ASC";
  84. if (!$result = $con->query($sqlraremat)){
  85. die ('There was an error running the query [' . $con->error . ']');
  86. }
  87. echo '<SELECT NAME="rarematerial">';
  88. while ($row = $result->fetch_array()){
  89. $matid = $row['materialid'];
  90. $raremat = $row['material'];
  91. echo '<OPTION VALUE="' . $matid . '">' . $raremat . '</OPTION>';
  92. }
  93. echo '</SELECT> ';
  94. echo ' and <INPUT TYPE="NUMBER" NAME="droppedgold" SIZE="4" MIN="1" MAX="9999"> gold pieces.';
  95. echo '<INPUT TYPE="HIDDEN" NAME="droptype" VALUE="2"><INPUT TYPE="HIDDEN" NAME="location" VALUE="' . $locid .'">';
  96. echo ' <BR /><CENTER><INPUT TYPE="SUBMIT" VALUE="Click me!"></FORM></CENTER><BR />';
  97. } else if ($whatdropped == "3"){
  98. echo '<FORM METHOD="POST" ACTION="gw-insert.php">';
  99. //code for what rune dropped
  100. $sqlrune = "SELECT * FROM `listrunes` ORDER BY `runeid` ASC";
  101. if (!$result = $con->query($sqlrune)){
  102. die ('There was an error running the query [' . $con->error . ']');
  103. }
  104. echo 'rune of <SELECT NAME="rune">';
  105. while ($row = $result->fetch_array()){
  106. $runeid = $row['runeid'];
  107. $rune = $row['runes'];
  108. echo '<OPTION VALUE="' . $runeid . '">' . $rune . '</OPTION>';
  109. }
  110. echo '</SELECT> ';
  111. echo ' and <INPUT TYPE="NUMBER" NAME="droppedgold" SIZE="4" MIN="1" MAX="9999"> gold pieces.';
  112. echo '<INPUT TYPE="HIDDEN" NAME="droptype" VALUE="3"><INPUT TYPE="HIDDEN" NAME="location" VALUE="' . $locid .'">';
  113. echo ' <BR /><CENTER><INPUT TYPE="SUBMIT" VALUE="Click me!"></FORM></CENTER><BR />';
  114. } else {
  115. echo '<FORM METHOD="POST"><SELECT NAME="gwdrop" onchange="this.form.submit()">';
  116. echo '<OPTION SELECTED DISABLED>choose one</OPTION>';
  117. echo '<OPTION VALUE="1">weapon</OPTION>';
  118. echo '<OPTION VALUE="2">material</OPTION>';
  119. echo '<OPTION VALUE="3">rune</OPTION></SELECT>';
  120. echo '<NOSCRIPT><INPUT TYPE="SUBMIT" VALUE="SUBMIT"></NOSCRIPT></FORM>';
  121. }
  122. echo 'Reload the page with no GET data? <A HREF="gw-record.php">RELOAD</A>';
  123. ?>