From 46e597c6f76ab87b69820588887df4579a204993 Mon Sep 17 00:00:00 2001 From: mauirixxx Date: Thu, 25 May 2017 09:56:09 -1000 Subject: [PATCH] renamed gw-pull to gw-history, fixed link in gw-action pull was a stupid name, naming the file history instantly tells you you're viewing the characters treasure history --- gw-action.php | 6 +---- gw-history.php | 75 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ gw-pull.php | 75 ---------------------------------------------------------- 3 files changed, 76 insertions(+), 80 deletions(-) create mode 100644 gw-history.php delete mode 100644 gw-pull.php diff --git a/gw-action.php b/gw-action.php index 792158a..0be9460 100644 --- a/gw-action.php +++ b/gw-action.php @@ -8,11 +8,7 @@ if ($action == 1){ //insert dropped items data echo '
'; } else if ($action == 2){ //view history of dropped items echo ''; - echo '
'; -} else if ($action == 3){ //toon creation page here - echo ''; - echo 'Character creation is currently disabled!

Click here to go to the main page'; - //echo '
'; //enable this and modify it when gw-create.php is made + echo '
'; } else { echo 'You shouldn\'t be seeing this, something went horribly horribly wrong!'; } diff --git a/gw-history.php b/gw-history.php new file mode 100644 index 0000000..de55d5f --- /dev/null +++ b/gw-history.php @@ -0,0 +1,75 @@ +Treasure Data + +connect_errno > 0){ + die ('Unable to connect to database [' . $db->connect_errno . ']'); +} +$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"; +if (!$result = $con->query($sql)){ + die ('There was an error running the query [' . $con->error . ']'); +} +if (mysqli_num_rows($result) > 0) { + while ($row = $result->fetch_array()){ + echo 'On ' . $row['historydate'] . ', "' . $row['charname'] . '" got ' . $row['goldrec'] . 'GP and '; + if ($row['itemtype'] == 16) { //this would be a rune + $runeid = $row['runetype']; + $sqlrune = "SELECT listrunes.`runeid`, listrunes.`runes` FROM listrunes WHERE listrunes.`runeid` = $runeid"; + if (!$result2 = $con->query($sqlrune)){ + die ('There was an error running the query [' . $con->error . ']'); + } + while ($row2 = $result2->fetch_array()){ + echo 'a rune of ' . $row2['runes']; + } + } else { + if (is_null($row['material'])) { + $itemrarity = $row['itemrarity']; + $itemattr = $row['itemattribute']; + $itemweap = $row['itemtype']; + $sqlrare = "SELECT listrarity.* FROM listrarity WHERE listrarity.`rareid` = $itemrarity"; + $sqlattr = "SELECT listattribute.* FROM listattribute WHERE listattribute.`weapattrid` = $itemattr"; + $sqlweap = "SELECT listtype.* FROM listtype WHERE listtype.`weaponid` = $itemweap"; + if (!$resultrarity = $con->query($sqlrare)){ + die ('There was an error running the query [' . $con->error . ']'); + } + while ($row3 = $resultrarity->fetch_array()){ + echo 'a ' . $row3['rarity']; + } + echo ' r' . $row['itemreq']; + if (!$resultattr = $con->query($sqlattr)){ + die ('There was an error running the query [' . $con->error . ']'); + } + while ($row4 = $resultattr->fetch_array()){ + echo ' ' . $row4['weaponattribute']; + } + if (!$resultweap = $con->query($sqlweap)){ + die ('There was an error running the query [' . $con->error . ']'); + } + while ($row5 = $resultweap->fetch_array()){ + echo ' ' . $row5['weapontype']; + } + echo ' named ' . $row['itemname']; + } else { + $matid = $row['material']; + $sqlmat = "SELECT material FROM materials WHERE materialid = $matid"; + if (!$resultmats = $con->query($sqlmat)){ + die ('There was an error running the query [' . $con->error . ']'); + } + while ($row6 = $resultmats->fetch_array()){ + echo 'a ' . $row6['material']; + } + } + } + echo ' at ' . $row['location'] . '
'; + } +} else { + echo 'There is no data to display for that character yet'; +} +?> +
+
+ \ No newline at end of file diff --git a/gw-pull.php b/gw-pull.php deleted file mode 100644 index de55d5f..0000000 --- a/gw-pull.php +++ /dev/null @@ -1,75 +0,0 @@ -Treasure Data - -connect_errno > 0){ - die ('Unable to connect to database [' . $db->connect_errno . ']'); -} -$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"; -if (!$result = $con->query($sql)){ - die ('There was an error running the query [' . $con->error . ']'); -} -if (mysqli_num_rows($result) > 0) { - while ($row = $result->fetch_array()){ - echo 'On ' . $row['historydate'] . ', "' . $row['charname'] . '" got ' . $row['goldrec'] . 'GP and '; - if ($row['itemtype'] == 16) { //this would be a rune - $runeid = $row['runetype']; - $sqlrune = "SELECT listrunes.`runeid`, listrunes.`runes` FROM listrunes WHERE listrunes.`runeid` = $runeid"; - if (!$result2 = $con->query($sqlrune)){ - die ('There was an error running the query [' . $con->error . ']'); - } - while ($row2 = $result2->fetch_array()){ - echo 'a rune of ' . $row2['runes']; - } - } else { - if (is_null($row['material'])) { - $itemrarity = $row['itemrarity']; - $itemattr = $row['itemattribute']; - $itemweap = $row['itemtype']; - $sqlrare = "SELECT listrarity.* FROM listrarity WHERE listrarity.`rareid` = $itemrarity"; - $sqlattr = "SELECT listattribute.* FROM listattribute WHERE listattribute.`weapattrid` = $itemattr"; - $sqlweap = "SELECT listtype.* FROM listtype WHERE listtype.`weaponid` = $itemweap"; - if (!$resultrarity = $con->query($sqlrare)){ - die ('There was an error running the query [' . $con->error . ']'); - } - while ($row3 = $resultrarity->fetch_array()){ - echo 'a ' . $row3['rarity']; - } - echo ' r' . $row['itemreq']; - if (!$resultattr = $con->query($sqlattr)){ - die ('There was an error running the query [' . $con->error . ']'); - } - while ($row4 = $resultattr->fetch_array()){ - echo ' ' . $row4['weaponattribute']; - } - if (!$resultweap = $con->query($sqlweap)){ - die ('There was an error running the query [' . $con->error . ']'); - } - while ($row5 = $resultweap->fetch_array()){ - echo ' ' . $row5['weapontype']; - } - echo ' named ' . $row['itemname']; - } else { - $matid = $row['material']; - $sqlmat = "SELECT material FROM materials WHERE materialid = $matid"; - if (!$resultmats = $con->query($sqlmat)){ - die ('There was an error running the query [' . $con->error . ']'); - } - while ($row6 = $resultmats->fetch_array()){ - echo 'a ' . $row6['material']; - } - } - } - echo ' at ' . $row['location'] . '
'; - } -} else { - echo 'There is no data to display for that character yet'; -} -?> -
-
- \ No newline at end of file