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文字以内のものにしてください。

74 行
3.2 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. $matid = $row['materialid'];
  57. $sqlmat = "SELECT material FROM materials WHERE materialid = $matid";
  58. if (!$resultmats = $con->query($sqlmat)){
  59. die ('There was an error running the query [' . $con->error . ']');
  60. }
  61. while ($row6 = $resultmats->fetch_array()){
  62. echo 'a ' . $row6['material'];
  63. }
  64. }
  65. }
  66. echo ' at <A HREF="' . $row['wikilink'] . '">' . $row['location'] . '</A><BR />';
  67. }
  68. } else {
  69. echo 'There is no data to display for that character yet';
  70. }
  71. ?>
  72. <BR />
  73. <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>
  74. </BODY>