-2

Been working on this script for few days, any help please how to correct this script:

I wanted to create a 1 script that will work for all pages:

    //Start session
session_start();

//Check whether the session variable SESS_MEMBER_ID is present or not
if(!isset($_SESSION['SESS_MEMBER_ID']) || (trim($_SESSION['SESS_MEMBER_ID']) == 'TRUE')) {
    header("location: access-denied.php");
    exit();
}

Error is: Warning: session_start() [function.session-start]: Cannot send session cache limiter - headers already sent (output started at /homepages/46/d445712420/htdocs/user/portugal

Thanks

Herbert
  • 21
  • 4

2 Answers2

1

You have some output before your session_start() call, so the HTTP headers have already been sent, and php would need to modify those to start the session, and it's not possible any more. Reorganise your code so the session_start() call happens before you send any output.

Maerlyn
  • 33,687
  • 18
  • 94
  • 85
0

Are you sure you want to compare it to the "TRUE" string ? I don't know what value you're expecting, but trying $var == TRUE could help.

mimipc
  • 1,354
  • 2
  • 14
  • 28