will PHP header() & exit() securely terminate a script before redirecting?

Posted by Haroldo on Stack Overflow See other posts from Stack Overflow or by Haroldo
Published on 2010-05-16T17:39:56Z Indexed on 2010/05/16 17:50 UTC
Read the original article Hit count: 131

Filed under:

Is the following a secure way of protecting a user only area?

if(!isset($_SESSION['username'])){redirect(SITE_ROOT . 'st_pages/login/');}

using:

function redirect($url)
    {
        header('Location: ' . $url);
        exit('<a href="' . $url . '">Redirecting you to: ' . $url . '</a>');
    }

© Stack Overflow or respective owner

Related posts about php