Jump to content

Archived

This topic is now archived and is closed to further replies.

lunac

Undefinded ERROR ? I don't see it -- Please help

Recommended Posts

I'm getting this error "[b]Notice: Undefined variable: l in [/b][b]/Users/dara/Sites/btm/includes/libraries/adminlib.php[/b] on line [b]70"
[/b] But I'm not sure what is causing it. I'm passing the $pagelevel into the function on run. The rest are set globally or set with in the function itself. $l is set right there in the while loop. If anyone can figure this out, please help. Thanks.

[code]function checkPagePermissions($pagelevel){
    //admin section only
    global $level, $currentmodule, $_tables;
    $thismodule = strtolower(str_replace(" ", "", $currentmodule));
    $y = mysqlSelect($_tables['modules'], "*", "WHERE title = '" . $thismodule . "'");
    while ($yy = @mysql_fetch_assoc($y)){
        $l = $level[$yy['level']];
    }
    if($l > $pagelevel){
        echo "error";
    } else {
        echo "ok";
    }
}
[/code]

Share this post


Link to post
Share on other sites
Is line 70 in the code snippet you show? I can't tell. Please indicate which is line 70.

Ken

Share this post


Link to post
Share on other sites
I'm going to guess that [code]if($l > $pagelevel){[/code]is line 70 and it's not going through the while loop. Do yourself a favor and set a default value for $l before you fetch the data.

ALSO, get rid of the while loop. If you're only expecting one value, just run the line inside the while logic. Have a statement like that doesn't make any sense whatsoever. You may also want to check that a value was fetched and your result was valid.

Share this post


Link to post
Share on other sites
Forget it, I called the function before the I set $currentmodule. So when it searched the database, it returned nothing. HUGE STUPID ATTACK!

Thanks for the help anyway.

~btw
thanks for the suggest on the while loop. Not sure why I had that. Coding at 1 in the morning, then looking over it the next day ::sigh::

Share this post


Link to post
Share on other sites

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.