$res=$mysqli->query("SELECT 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");
$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()){
$ret[]=$row;
}
return$ret;
}
functionget_lostitems($onlyUnmatched=false){
global$mysqli;
if($onlyUnmatched){
$res=$mysqli->query("SELECT lost_items.* FROM lost_items LEFT JOIN matches ON lost_items.id = matches.l_id WHERE lost_items.del = 0 AND matches.l_id IS NULL ORDER BY lost_items.id DESC");
}else{
$res=$mysqli->query("SELECT * FROM lost_items WHERE lost_items.del = 0 ORDER BY id ASC");
$res=$mysqli->query("SELECT * FROM found_items, files WHERE MD5(found_items.id) = '".md5($id)."' AND found_items.id = files.item_id ORDER BY files.id DESC");
$res=$mysqli->query("SELECT * FROM found_items, files WHERE MD5(found_items.uid) = '".md5($uid)."' AND found_items.id = files.item_id ORDER BY files.id DESC");