Advertisement
If you have a new account but are having problems posting or verifying your account, please email us on hello@boards.ie for help. Thanks :)
Hello all! Please ensure that you are posting a new thread or question in the appropriate forum. The Feedback forum is overwhelmed with questions that are having to be moved elsewhere. If you need help to verify your account contact hello@boards.ie
Hi there,
There is an issue with role permissions that is being worked on at the moment.
If you are having trouble with access or permissions on regional forums please post here to get access: https://www.boards.ie/discussion/2058365403/you-do-not-have-permission-for-that#latest

PHP - Undefined index??

  • 31-05-2007 10:13pm
    #1
    Registered Users, Registered Users 2 Posts: 1,987 ✭✭✭


    I'm trying to check a session variable and if its not initailised then it will just show a login box but i get the below notice, any idea how to get around this??
    Notice: Undefined index: auth in C:\Apache\htdocs\bt\forum.php on line 48
    [PHP]try
    {
    if($_SESSION == 1207)
    {
    stats();
    }
    }
    catch(Exception $e)
    {
    echo'Welcome guest';
    }[/PHP]


Comments

  • Closed Accounts Posts: 18,163 ✭✭✭✭Liam Byrne


    Your PHP warning level is set to "notice", i.e. 8.

    If you can't change the warning level, add an "isset" check to the code

    if ((isset($_SESSION["auth"])) && ($_SESSION["auth"]==1207)) {

    }

    The first part of the if will be evaluated first; if it's not set, it can't be set to 1207, so it'll still be false.

    L


Advertisement