Domanda

I've to check whether the end user is admin or not, I've done right (I hope) but it fails to check. Here is what 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 it fails to check if the end user is admin. :/ No error at all. What is missing here?

È stato utile?

Soluzione

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;
    }
}
Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top