Implemented Edit Found Items
This commit is contained in:
parent
03655c579b
commit
efe17de00c
3 changed files with 289 additions and 2 deletions
16
index.php
16
index.php
|
@ -23,9 +23,9 @@ function auth(){
|
|||
function get_founditems($onlyUnmatched = false){
|
||||
global $mysqli;
|
||||
if ($onlyUnmatched) {
|
||||
$res = $mysqli->query("SELECT found_items.*, files.hash FROM files, found_items LEFT JOIN matches ON found_items.id = matches.f_id WHERE files.item_id = found_items.id AND found_items.del = 0 AND matches.f_id IS NULL ORDER BY found_items.id DESC");
|
||||
$res = $mysqli->query("SELECT distinct found_items.*, files.hash FROM (SELECT files.* from files ORDER BY files.id DESC LIMIT 100000) as files, found_items LEFT JOIN matches ON found_items.id = matches.f_id WHERE found_items.del = 0 AND files.item_id = found_items.id AND matches.f_id IS NULL GROUP BY files.item_id ORDER BY found_items.id DESC");
|
||||
} else {
|
||||
$res = $mysqli->query("SELECT found_items.*, files.hash FROM files, found_items WHERE files.item_id = found_items.id AND found_items.del = 0 ORDER BY found_items.id ASC");
|
||||
$res = $mysqli->query("SELECT found_items.*, files.hash FROM (SELECT files.* from files ORDER BY files.id DESC LIMIT 100000) as files, found_items WHERE files.item_id = found_items.id AND found_items.del = 0 GROUP BY files.item_id ORDER BY found_items.id ASC");
|
||||
}
|
||||
$ret = array();
|
||||
while ($row = $res->fetch_assoc()) {
|
||||
|
@ -48,6 +48,18 @@ function get_lostitems($onlyUnmatched = false){
|
|||
return $ret;
|
||||
}
|
||||
|
||||
function get_founditem($id){
|
||||
global $mysqli;
|
||||
|
||||
$res = $mysqli->query("SELECT * FROM found_items, files WHERE found_items.id = $id AND found_items.id = files.item_id ORDER BY files.id DESC");
|
||||
|
||||
$ret = array();
|
||||
while ($row = $res->fetch_assoc()) {
|
||||
$ret[] = $row;
|
||||
}
|
||||
return $ret;
|
||||
}
|
||||
|
||||
function get_matches(){
|
||||
global $mysqli;
|
||||
$res = $mysqli->query("SELECT matches.id AS id, matches.f_id as f_id, matches.l_id as l_id, lost.was as l_desc, items.was as f_desc "
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue