From 77df85c499b4cf2fdbbeee65e4148f4e1489adc2 Mon Sep 17 00:00:00 2001 From: Neku Date: Tue, 17 Dec 2013 01:53:48 +0100 Subject: Update core.php --- moe/includes/core.php | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) (limited to 'moe/includes/core.php') diff --git a/moe/includes/core.php b/moe/includes/core.php index d29d833..cf77837 100644 --- a/moe/includes/core.php +++ b/moe/includes/core.php @@ -43,7 +43,20 @@ function login ($email, $pass) { function search ($word) { global $db; $str = "%".$word."%"; - $do = $db->prepare("SELECT * FROM files WHERE orginalname LIKE (:1) OR filename LIKE (:2) LIMIT 5"); + if($_SESSION['level'] === '1'){ + $do = $db->prepare("SELECT orginalname, filename FROM files WHERE orginalname LIKE (:1) OR filename LIKE (:2)"); + $do->bindParam(':1', $str); + $do->bindParam(':2', $str); + $do->execute(); + + while ($row = $do->fetch(PDO::FETCH_ASSOC)) { + print $row['orginalname'].' - '.$row['filename'].''; + } + + //Yes I love not being efficient, deal with it. + }else{ + + $do = $db->prepare("SELECT orginalname, filename FROM files WHERE orginalname LIKE (:1) OR filename LIKE (:2) LIMIT 5"); $do->bindParam(':1', $str); $do->bindParam(':2', $str); $do->execute(); @@ -51,6 +64,7 @@ function search ($word) { while ($row = $do->fetch(PDO::FETCH_ASSOC)) { print $row['orginalname'].' - '.$row['filename'].'
'; } + } } function cfdelete ($file) { -- cgit v1.2.3