My code is this:

<?php
    //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']) == '')) {
        header("location: access-denied.php");
        exit();
    }

?>

and I am facing this warning, when I login succcessfully:

Warning: session_start() [function.session-start]: Cannot send session cache limiter - headers already sent

if any buddy know this answer then plz tell it to me,

thnx

Recommended Answers

All 2 Replies

The session_start() requires that nothing should be outputted to the page before this statement is called. The easiest way to make sure that this is the case is to put the session_start() as the first statement on the page.

Make sure you have no spaces before the opening <?php tag, if that is your actual code spaces before that have caused issues before.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.