Jump to content

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]
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.
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::
This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

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.