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 символов.

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