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

75 行
3.2 KiB

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