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.
 
 
 

67 lines
2.8 KiB

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