Skip to content

Commit

Permalink
Sign Lookup Update
Browse files Browse the repository at this point in the history
Signs now with sign data!
... along with PHP <? ?> fix.
  • Loading branch information
chuushi committed Jan 26, 2016
1 parent 96736d6 commit 1689271
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 26 deletions.
2 changes: 2 additions & 0 deletions changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ v0.6.0 - January 25, 2016
- Set PDO mysql charset to UTF-8 for special character compatibility
- Added global date and time formatting option
- `conn.php`:
- Added a way to get sign data!
- Modified the way requests are handled.
- Added support for searching with current Minecraft block/item names
- Searching with legacy names work as long as it isn't overriden by new names.
Expand All @@ -33,6 +34,7 @@ v0.6.0 - January 25, 2016
feel like Google!
- Coordinate defining and date/limit fields are combined to save room when the
window is large enough.
- Added sign results. It's not working properly yet.
- "Load more" has been styled to bootstrap.
- Form submitting now uses browser's built-in handling rather than by
unnecessary javascript.
Expand Down
31 changes: 8 additions & 23 deletions conn.php
Original file line number Diff line number Diff line change
@@ -1,23 +1,7 @@
<?php
// PHP code by SimonOrJ. All Rights Reserved.
// Requires PHP 5.4+
/* GET outputs will be:
- array action (a)
- array user (u)
- int radius (r)
- int query limit (lim)
- string time (t) in seconds
- array block (b)
- string chat/command/sign search (keyword)
- in_array exclude (e) - ub in an array to add "NOT" in the injection string.
- array center/first coordinate (xyz)
- array second coordinate (xyz2)
- int wordl (wid)
- bool asending time? (asendt) (past-to-present or present-to-past)
- bool session
- in_array flag - su
Database tables to use:
/* PHP code by SimonOrJ. All Rights Reserved.
* Requires PHP 5.4+
* Database tables to use:
block (a: block, click, kill)
entity (for mob kills) (use with block table)
sign (with block>data minecraft:sign and minecraft:wall_sign)
Expand All @@ -28,10 +12,7 @@
session (a:session)
username_log (a:username)
Output object:
out[0]:
['success'] 0 or 1
['err'] block, username, username and block, invalid query, and no results
Output status codes:
0 - Success
1 - No Results
2 - SQL Query Unsuccessful
Expand Down Expand Up @@ -298,6 +279,10 @@ function sqlreq($table) {
else {
if ($r["action"] == 2) $r["table"] = "click";
$r["type"] = $cm->getMc($cc->getValue($r["type"],"material"));
if(in_array($r["type"],["minecraft:standing_sign","minecraft:wall_sign"],true)) {
$sign = $codb->query($r["signSQL"]="SELECT `line_1`,`line_2`,`line_3`,`line_4` FROM ".$co_."sign WHERE x=".$r["x"]." AND y=".$r["y"]." AND z=".$r["z"]." AND time".(($r["action"]=="0")?"<":">=").$r["time"]." ORDER BY time ".(($r["action"]=="0")?"DESC":"ASC")." LIMIT 1;");
$r["signdata"]=$sign->fetch(PDO::FETCH_NUM);
}
}
}
if ($r["wid"]) $r["wid"] = $cc->getValue($r["wid"],"world");
Expand Down
6 changes: 3 additions & 3 deletions index.php
Original file line number Diff line number Diff line change
Expand Up @@ -235,7 +235,7 @@ function putInQ(element,type,flag) {
return false;
}

<?
<?php
// TODO: Add "top" button that follows as you scroll and put this code:
//$("html, body").animate({ scrollTop: $('#title1').offset().top }, 1000);
?>
Expand Down Expand Up @@ -328,7 +328,7 @@ function phraseReturn(obj,more) {
else if(r[i]['rolled_back'] == "1") r[i]['rolled_back'] = "Rolled.";
}
// Coordinates, Type:Data, Amount, Rollback
o += '>'+r[i]['x']+' '+r[i]['y']+' '+r[i]['z']+' '+r[i]['wid']+'</td><td>'+((r[i]["table"] == "session")?"":r[i]['type']+':'+r[i]['data'])+'</td><td'+((r[i]['action'] == "0")?' class="table-warning">-':((r[i]['action'] == "1")?' class="table-info">+':'>'))+((r[i]['table'] == "container") ? r[i]['amount'] : '')+'</td><td>'+r[i]['rolled_back'];
o += '>'+r[i]['x']+' '+r[i]['y']+' '+r[i]['z']+' '+r[i]['wid']+"</td><td>"+((r[i]["table"] == "session")?"":((r[i]["signdata"])?'<span data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">':"")+r[i]['type']+':'+r[i]['data']+((r[i]["signdata"])?'</span><div class="dropdown-menu"><span class="dropdown-item">'+r[i]["signdata"][0]+'</span><span class="dropdown-item">'+r[i]["signdata"][1]+'</span><span class="dropdown-item">'+r[i]["signdata"][2]+'</span><span class="dropdown-item">'+r[i]["signdata"][3]+'</span></div>':""))+'</td><td'+((r[i]['action'] == "0")?' class="table-warning">-':((r[i]['action'] == "1")?' class="table-info">+':'>'))+((r[i]['table'] == "container") ? r[i]['amount'] : '')+'</td><td>'+r[i]['rolled_back'];
break;
case "chat":
case "command":
Expand All @@ -344,7 +344,7 @@ function phraseReturn(obj,more) {
}
</script>
<div class="input-group-btn">
<span class="btn-sm" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
<span data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
Action
</span>
<div class="dropdown-menu">
Expand Down

0 comments on commit 1689271

Please sign in to comment.