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个字符
 
 
 

90 行
3.6 KiB

  1. <!DOCTYPE html>
  2. <HTML>
  3. <HEAD>
  4. <link rel="stylesheet" type="text/css" href="gw-style.css">
  5. <TITLE>Treasure Data</TITLE>
  6. </HEAD>
  7. <BODY>
  8. <CENTER><TABLE BORDER="0">
  9. <?php
  10. session_start();
  11. include_once 'gw-connect.php';
  12. $con = new mysqli(DATABASE_HOST, DATABASE_USER, DATABASE_PASS, DATABASE_NAME);
  13. //$cnameid = mysqli_real_escape_string($con, $_POST['cnameid']); //need to sanitize & validate this input somehow
  14. $cnameid = $_SESSION['playerid'];
  15. if ($con->connect_errno > 0){
  16. die ('Unable to connect to database [' . $db->connect_errno . ']');
  17. }
  18. $sql = "SELECT history.*, treasurelocation.*, playername.`playerid`, playername.`charname` FROM ((history INNER JOIN treasurelocation ON history.`locationid` = treasurelocation.`treasureid`) INNER JOIN playername ON history.`charnameid` = playername.`playerid`) WHERE history.`charnameid` = '$cnameid' ORDER BY `historydate`,`historyid` ASC";
  19. if (!$result = $con->query($sql)){
  20. die ('There was an error running the query [' . $con->error . ']');
  21. }
  22. if (mysqli_num_rows($result) > 0) {
  23. while ($row = $result->fetch_array()){
  24. echo '<TR><TD>On ' . $row['historydate'] . ', "' . $row['charname'] . '" got ' . $row['goldrec'] . 'GP and ';
  25. if ($row['itemtype'] == 16) { //this would be a rune
  26. $runeid = $row['runetype'];
  27. $sqlrune = "SELECT listrunes.`runeid`, listrunes.`runes` FROM listrunes WHERE listrunes.`runeid` = $runeid";
  28. if (!$result2 = $con->query($sqlrune)){
  29. die ('There was an error running the query [' . $con->error . ']');
  30. }
  31. while ($row2 = $result2->fetch_array()){
  32. echo 'a rune of ' . $row2['runes'];
  33. }
  34. } else if ($row['itemtype'] == 17) { //nothing dropped, but showing the recorded date
  35. echo 'nothing dropped at this location on this date';
  36. } else {
  37. if (is_null($row['material'])) {
  38. $itemrarity = $row['itemrarity'];
  39. $itemattr = $row['itemattribute'];
  40. $itemweap = $row['itemtype'];
  41. $sqlrare = "SELECT listrarity.* FROM listrarity WHERE listrarity.`rareid` = $itemrarity";
  42. $sqlattr = "SELECT listattribute.* FROM listattribute WHERE listattribute.`weapattrid` = $itemattr";
  43. $sqlweap = "SELECT listtype.* FROM listtype WHERE listtype.`weaponid` = $itemweap";
  44. if (!$resultrarity = $con->query($sqlrare)){
  45. die ('There was an error running the query [' . $con->error . ']');
  46. }
  47. while ($row3 = $resultrarity->fetch_array()){
  48. echo 'a ' . $row3['rarity'];
  49. }
  50. echo ' r' . $row['itemreq'];
  51. if (!$resultattr = $con->query($sqlattr)){
  52. die ('There was an error running the query [' . $con->error . ']');
  53. }
  54. while ($row4 = $resultattr->fetch_array()){
  55. echo ' ' . $row4['weaponattribute'];
  56. }
  57. if (!$resultweap = $con->query($sqlweap)){
  58. die ('There was an error running the query [' . $con->error . ']');
  59. }
  60. while ($row5 = $resultweap->fetch_array()){
  61. echo ' ' . $row5['weapontype'];
  62. }
  63. echo ' named ' . $row['itemname'];
  64. } else {
  65. $matid = $row['material'];
  66. $sqlmat = "SELECT material FROM materials WHERE materialid = $matid";
  67. if (!$resultmats = $con->query($sqlmat)){
  68. die ('There was an error running the query [' . $con->error . ']');
  69. }
  70. while ($row6 = $resultmats->fetch_array()){
  71. echo 'a ' . $row6['material'];
  72. }
  73. }
  74. }
  75. echo ' at <A HREF="' . $row['wikilink'] . '" CLASS="navlink">' . $row['location'] . '</A></TD></TR>';
  76. }
  77. } else {
  78. echo '<CENTER>There is no data to display for that character yet</CENTER><BR />';
  79. }
  80. ?>
  81. </TABLE></CENTER>
  82. <BR />
  83. <CENTER>
  84. <FORM METHOD="POST" ACTION="gw-toon.php">
  85. <INPUT TYPE="HIDDEN" NAME="cnameid" VALUE="0">
  86. <INPUT TYPE="SUBMIT" VALUE="Return to character selection">
  87. </FORM>
  88. </CENTER>
  89. </BODY>
  90. </HTML>