php - Check if the end user is admin -
i've check whether end user admin or not, i've done right (i hope) fails check. here i'm using;
function checked_already($pid,$input) { global $db; if ($mybb->user['usergroup'] != "4") { error_no_permission(); } $query = $db->simple_select("users", "username", "uid='{$input}' or username='{$input}'"); $user = $db->fetch_array($query); if (!$user['username']) { echo "nothing found!!"; exit; } }
but fails check if end user admin. :/ no error @ all. missing here?
you've not used $mybb in global. try this;
function checked_already($pid,$input) { global $db, $mybb; if ($mybb->user['usergroup'] != "4") { error_no_permission(); } $query = $db->simple_select("users", "username", "uid='{$input}' or username='{$input}'"); $user = $db->fetch_array($query); if (!$user['username']) { echo "nothing found!!"; exit; } }
Comments
Post a Comment