Foreach PHP Error

Posted by Logan on Stack Overflow See other posts from Stack Overflow or by Logan
Published on 2012-04-15T17:23:38Z Indexed on 2012/04/15 17:30 UTC
Read the original article Hit count: 798

Filed under:
|

I am receiving the following foreach error on my PHP file and I have no idea how to fix it. Does anyone have any ideas?

When I load the page I get this:

Warning: Invalid argument supplied for foreach() in /home/mysite/public_html/merge/class/global_functions.php on line 61

Warning: Invalid argument supplied for foreach() in /home/mysite/public_html/merge/class/global_functions.php on line 89

Warning: Invalid argument supplied for foreach() in /home/mysite/public_html/merge/class/global_functions.php on line 89

Warning: Invalid argument supplied for foreach() in /home/mysite/public_html/merge/class/global_functions.php on line 89

Warning: Invalid argument supplied for foreach() in /home/mysite/public_html/merge/class/global_functions.php on line 89

Warning: Invalid argument supplied for foreach() in /home/mysite/public_html/merge/class/global_functions.php on line 89

Warning: Invalid argument supplied for foreach() in /home/mysite/public_html/merge/class/global_functions.php on line 89

Warning: Invalid argument supplied for foreach() in /home/mysite/public_html/merge/class/global_functions.php on line 89

Warning: Invalid argument supplied for foreach() in /home/mysite/public_html/merge/class/global_functions.php on line 89

Warning: Invalid argument supplied for foreach() in /home/mysite/public_html/merge/class/global_functions.php on line 89

Warning: Invalid argument supplied for foreach() in /home/mysite/public_html/merge/class/global_functions.php on line 89

Warning: Invalid argument supplied for foreach() in /home/mysite/public_html/merge/class/global_functions.php on line 89

Warning: Invalid argument supplied for foreach() in /home/mysite/public_html/merge/class/global_functions.php on line 89

Warning: Invalid argument supplied for foreach() in /home/mysite/public_html/merge/class/global_functions.php on line 89

Warning: Invalid argument supplied for foreach() in /home/mysite/public_html/merge/class/global_functions.php on line 89

Warning: Invalid argument supplied for foreach() in /home/mysite/public_html/merge/class/global_functions.php on line 89

Warning: Invalid argument supplied for foreach() in /home/mysite/public_html/merge/class/global_functions.php on line 89

Warning: Invalid argument supplied for foreach() in /home/mysite/public_html/merge/class/global_functions.php on line 89

Warning: Invalid argument supplied for foreach() in /home/mysite/public_html/merge/class/global_functions.php on line 89

Warning: Invalid argument supplied for foreach() in /home/mysite/public_html/merge/class/global_functions.php on line 89

Warning: Invalid argument supplied for foreach() in /home/mysite/public_html/merge/class/global_functions.php on line 89

Warning: Invalid argument supplied for foreach() in /home/mysite/public_html/merge/class/global_functions.php on line 89

Warning: Invalid argument supplied for foreach() in /home/mysite/public_html/merge/class/global_functions.php on line 89

Warning: Invalid argument supplied for foreach() in /home/mysite/public_html/merge/class/global_functions.php on line 89

Warning: Invalid argument supplied for foreach() in /home/mysite/public_html/merge/class/global_functions.php on line 89

Warning: Invalid argument supplied for foreach() in /home/mysite/public_html/merge/class/global_functions.php on line 89

Warning: Invalid argument supplied for foreach() in /home/mysite/public_html/merge/class/global_functions.php on line 89

Warning: Invalid argument supplied for foreach() in /home/mysite/public_html/merge/class/global_functions.php on line 89

Warning: Invalid argument supplied for foreach() in /home/mysite/public_html/merge/class/global_functions.php on line 89

Warning: Invalid argument supplied for foreach() in /home/mysite/public_html/merge/class/global_functions.php on line 89

Warning: Invalid argument supplied for foreach() in /home/mysite/public_html/merge/class/global_functions.php on line 89

Warning: Invalid argument supplied for foreach() in /home/mysite/public_html/merge/class/global_functions.php on line 89

Warning: Invalid argument supplied for foreach() in /home/mysite/public_html/merge/class/global_functions.php on line 89

Warning: Invalid argument supplied for foreach() in /home/mysite/public_html/merge/class/global_functions.php on line 89

Warning: Invalid argument supplied for foreach() in /home/mysite/public_html/merge/class/global_functions.php on line 89

Warning: Invalid argument supplied for foreach() in /home/mysite/public_html/merge/class/global_functions.php on line 89

Warning: Invalid argument supplied for foreach() in /home/mysite/public_html/merge/class/global_functions.php on line 89

Warning: Invalid argument supplied for foreach() in /home/mysite/public_html/merge/class/global_functions.php on line 89

Warning: Invalid argument supplied for foreach() in /home/mysite/public_html/merge/class/global_functions.php on line 89

Warning: Invalid argument supplied for foreach() in /home/mysite/public_html/merge/class/global_functions.php on line 89

Warning: Invalid argument supplied for foreach() in /home/mysite/public_html/merge/class/global_functions.php on line 89

Warning: Invalid argument supplied for foreach() in /home/mysite/public_html/merge/class/global_functions.php on line 89

Warning: Invalid argument supplied for foreach() in /home/mysite/public_html/merge/class/global_functions.php on line 89

Warning: Invalid argument supplied for foreach() in /home/mysite/public_html/merge/class/global_functions.php on line 89

Warning: Invalid argument supplied for foreach() in /home/mysite/public_html/merge/class/global_functions.php on line 89

Warning: Invalid argument supplied for foreach() in /home/mysite/public_html/merge/class/global_functions.php on line 89

Warning: Invalid argument supplied for foreach() in /home/mysite/public_html/merge/class/global_functions.php on line 89

Warning: Invalid argument supplied for foreach() in /home/mysite/public_html/merge/class/global_functions.php on line 89

Warning: Invalid argument supplied for foreach() in /home/mysite/public_html/merge/class/global_functions.php on line 89

Warning: Invalid argument supplied for foreach() in /home/mysite/public_html/merge/class/global_functions.php on line 89

Warning: Invalid argument supplied for foreach() in /home/mysite/public_html/merge/class/global_functions.php on line 89

Warning: Invalid argument supplied for foreach() in /home/mysite/public_html/merge/class/global_functions.php on line 89

Warning: Invalid argument supplied for foreach() in /home/mysite/public_html/merge/class/global_functions.php on line 89

Warning: Invalid argument supplied for foreach() in /home/mysite/public_html/merge/class/global_functions.php on line 89

Warning: Invalid argument supplied for foreach() in /home/mysite/public_html/merge/class/global_functions.php on line 89

Warning: Invalid argument supplied for foreach() in /home/mysite/public_html/merge/class/global_functions.php on line 89

Warning: Invalid argument supplied for foreach() in /home/mysite/public_html/merge/class/global_functions.php on line 89

Warning: Invalid argument supplied for foreach() in /home/mysite/public_html/merge/class/global_functions.php on line 89

Warning: Invalid argument supplied for foreach() in /home/mysite/public_html/merge/class/global_functions.php on line 89

Warning: Invalid argument supplied for foreach() in /home/mysite/public_html/merge/class/global_functions.php on line 89

Warning: Invalid argument supplied for foreach() in /home/mysite/public_html/merge/class/global_functions.php on line 89

Warning: Invalid argument supplied for foreach() in /home/mysite/public_html/merge/class/global_functions.php on line 89

Warning: Invalid argument supplied for foreach() in /home/mysite/public_html/merge/class/global_functions.php on line 89

Warning: Invalid argument supplied for foreach() in /home/mysite/public_html/merge/class/global_functions.php on line 89

Warning: Invalid argument supplied for foreach() in /home/mysite/public_html/merge/class/global_functions.php on line 89

Warning: Invalid argument supplied for foreach() in /home/mysite/public_html/merge/class/global_functions.php on line 89

Line 61 and 89 of my /class/global_functions.php are as followed:

Here is my code from line 61 to line 98:

    foreach($GLOBALS['userpermbit'] as $v)
    {
        if(strstr($v['perm'],'|'.$pageperm_id[0]['id'].'|'))
            return true;
    }

    //if they dont have perms and we're not externally including functions return false
    if ($GLOBALS['external'] != true) return false; return true;

}

//FUNCTION: quick perm check using perm info from the onload perm check 
function stealthPermCheck($req)
{
    #if theyre an admin give them perms
    if(@in_array($GLOBALS['user'][0]['id'], $GLOBALS['superAdmins']))
            return true;    

    if(!is_numeric($req))
    {
        #if the req is numeric we need to match a title, not a permid. So try to do that
        foreach($GLOBALS['userpermbit'] as $v)
        {
            if(stristr($v['title'],$req))
                return true;
        }
    }else{
        #check if they have perms numerically if so return true
        foreach($GLOBALS['userpermbit'] as $v)
        {
            if(strstr($v['perm'],'|'.$req.'|'))
                return true;
        }
    }

    #if none of this returned true they dont have perms, return false
    return false;
}

© Stack Overflow or respective owner

Related posts about php

Related posts about foreach