diff options
| author | Neku <neku@pomf.se> | 2013-12-17 01:53:48 +0100 |
|---|---|---|
| committer | Neku <neku@pomf.se> | 2013-12-17 01:53:48 +0100 |
| commit | 77df85c499b4cf2fdbbeee65e4148f4e1489adc2 (patch) | |
| tree | 3573c076bcc3278eafd2b2a2e7681243e59cc7a0 /moe/includes | |
| parent | 46efdece21d3c13f1888b846953d61f6af0e521a (diff) | |
Update core.php
Diffstat (limited to 'moe/includes')
| -rw-r--r-- | moe/includes/core.php | 16 |
1 files changed, 15 insertions, 1 deletions
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'].'<a href="http://moe.pomf.se/includes/api.php?do=delete&f='.$row['filename'].'" target="_BLANK"<br/>'; + } + + //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'].'<br/>'; } + } } function cfdelete ($file) { |
