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.
 
 
 

93 lines
3.7 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. $profcolor = $_SESSION['profcolor'];
  16. if ($con->connect_errno > 0){
  17. die ('Unable to connect to database [' . $db->connect_errno . ']');
  18. }
  19. $sql = "SELECT history.*, treasuredata.*, playername.`playerid`, playername.`charname` FROM ((history INNER JOIN treasuredata ON history.`locationid` = treasuredata.`treasureid`) INNER JOIN playername ON history.`charnameid` = playername.`playerid`) WHERE history.`charnameid` = '$cnameid' ORDER BY `historydate`,`historyid` ASC";
  20. if (!$result = $con->query($sql)){
  21. die ('There was an error running the query [' . $con->error . ']');
  22. }
  23. if (mysqli_num_rows($result) > 0) {
  24. echo '<STYLE TYPE="TEXT/CSS" MEDIA="SCREEN">body { background-color: ' . $profcolor . '; }</STYLE>';
  25. while ($row = $result->fetch_array()){
  26. echo '<TR><TD>On ' . $row['historydate'] . ', "' . $row['charname'] . '" got ' . $row['goldrec'] . 'GP and ';
  27. if ($row['itemtype'] == 16) { //this would be a rune
  28. $runeid = $row['runetype'];
  29. $sqlrune = "SELECT listrunes.`runeid`, listrunes.`runes` FROM listrunes WHERE listrunes.`runeid` = $runeid";
  30. if (!$result2 = $con->query($sqlrune)){
  31. die ('There was an error running the query [' . $con->error . ']');
  32. }
  33. while ($row2 = $result2->fetch_array()){
  34. echo 'a rune of ' . $row2['runes'];
  35. }
  36. } else if ($row['itemtype'] == 17) { //nothing dropped, but showing the recorded date
  37. echo 'nothing dropped at this location on this date';
  38. } else {
  39. if (is_null($row['material'])) {
  40. $itemrarity = $row['itemrarity'];
  41. $itemattr = $row['itemattribute'];
  42. $itemweap = $row['itemtype'];
  43. $sqlrare = "SELECT listrarity.* FROM listrarity WHERE listrarity.`rareid` = $itemrarity";
  44. $sqlattr = "SELECT listattribute.* FROM listattribute WHERE listattribute.`weapattrid` = $itemattr";
  45. $sqlweap = "SELECT listtype.* FROM listtype WHERE listtype.`weaponid` = $itemweap";
  46. if (!$resultrarity = $con->query($sqlrare)){
  47. die ('There was an error running the query [' . $con->error . ']');
  48. }
  49. while ($row3 = $resultrarity->fetch_array()){
  50. echo 'a ' . $row3['rarity'];
  51. }
  52. echo ' r' . $row['itemreq'];
  53. if (!$resultattr = $con->query($sqlattr)){
  54. die ('There was an error running the query [' . $con->error . ']');
  55. }
  56. while ($row4 = $resultattr->fetch_array()){
  57. echo ' ' . $row4['weaponattribute'];
  58. }
  59. if (!$resultweap = $con->query($sqlweap)){
  60. die ('There was an error running the query [' . $con->error . ']');
  61. }
  62. while ($row5 = $resultweap->fetch_array()){
  63. echo ' ' . $row5['weapontype'];
  64. }
  65. echo ' named ' . $row['itemname'];
  66. } else {
  67. $matid = $row['material'];
  68. $sqlmat = "SELECT material FROM materials WHERE materialid = $matid";
  69. if (!$resultmats = $con->query($sqlmat)){
  70. die ('There was an error running the query [' . $con->error . ']');
  71. }
  72. while ($row6 = $resultmats->fetch_array()){
  73. echo 'a ' . $row6['material'];
  74. }
  75. }
  76. }
  77. echo ' at <A HREF="' . $row['wikilink'] . '" CLASS="navlink">' . $row['location'] . '</A></TD></TR>';
  78. }
  79. } else {
  80. echo '<CENTER>There is no data to display for that character yet</CENTER><BR />';
  81. }
  82. ?>
  83. </TABLE></CENTER>
  84. <BR />
  85. <CENTER>
  86. <FORM METHOD="POST" ACTION="gw-toon.php">
  87. <INPUT TYPE="HIDDEN" NAME="cnameid" VALUE="0">
  88. <INPUT TYPE="SUBMIT" VALUE="Return to character selection">
  89. </FORM>
  90. </CENTER>
  91. </BODY>
  92. </HTML>