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.
Non puoi selezionare più di 25 argomenti Gli argomenti devono iniziare con una lettera o un numero, possono includere trattini ('-') e possono essere lunghi fino a 35 caratteri.
 
 
 

40 righe
2.3 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['cname']); //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 * FROM `history` WHERE `charname` = '$cnameid' ORDER BY `historydate` ASC"; //old sql statement that works currently
  11. #$sql = "SELECT history.*, treasurelocation.* FROM history LEFT OUTER JOIN treasurelocation ON history.`locationid` = treasurelocation.`treasureid` WHERE history.`charname` = '$cnameid' ORDER BY `historydate` ASC"; //round 2 of SQL queries, saving this since it still works
  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. echo 'a rune of ' . $row['runetype'];
  21. } else {
  22. if (is_null($row['material'])) {
  23. echo 'a ' . $row['itemrarity'] . ' r' . $row['itemreq'] . ' ' . $row['itemattribute'] . ' ' . $row['itemtype'] . ' named ' . $row['itemname'] . ''; //itemtype changed, need to convert itemtype to something readable
  24. } else {
  25. echo 'a ' . $row['material'];
  26. }
  27. }
  28. echo ' at <A HREF="' . $row['wikilink'] . '">' . $row['location'] . '</A><BR />';
  29. }
  30. } else {
  31. echo 'There is no data to display for that character yet';
  32. }
  33. # test getting rune results without breaking working parts
  34. $sqlrune = "SELECT listrunes.`runeid`, listrunes.`runes` FROM listrunes WHERE listrunes.`runeid` = $runeid";
  35. $runeresults = mysqli_query($con, $sqlrune);
  36. echo 'Results of mapping runeid to runes: ' $runeresults;
  37. ?>
  38. <BR />
  39. Return to <A HREF="gw-toon.php">character selection</A> page
  40. </BODY>