mirror of
https://github.com/sigmasternchen/webcli
synced 2025-03-15 22:28:54 +00:00
some error checking
This commit is contained in:
parent
7935872be3
commit
81f2624ab1
1 changed files with 4 additions and 1 deletions
|
@ -39,7 +39,10 @@
|
||||||
}
|
}
|
||||||
static public function getIdByUsername ($username) {
|
static public function getIdByUsername ($username) {
|
||||||
global $db;
|
global $db;
|
||||||
return $db->query("SELECT `ID` FROM `users` WHERE `name`='" . $db->real_escape_string($username) . "'")->fetch_object()->ID;
|
$result = $db->query("SELECT `ID` FROM `users` WHERE `name`='" . $db->real_escape_string($username) . "'");
|
||||||
|
if (!$result->num_rows)
|
||||||
|
throw new Exception("No entry for user " . $username);
|
||||||
|
return $result->fetch_object()->ID;
|
||||||
}
|
}
|
||||||
static public function getRightsOnFile($uid, $file) {
|
static public function getRightsOnFile($uid, $file) {
|
||||||
if ($uid == $file->userFK)
|
if ($uid == $file->userFK)
|
||||||
|
|
Loading…
Reference in a new issue