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개 이상의 토픽을 선택하실 수 없습니다. Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

85 lines
3.3 KiB

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