Should we use require_once instead header location?

Posted by jartaud on Stack Overflow See other posts from Stack Overflow or by jartaud
Published on 2010-06-17T02:09:45Z Indexed on 2010/06/17 2:12 UTC
Read the original article Hit count: 291

Filed under:
|
|
|

Hello commnunity, i have somthing like this: (if this page needs the user to be logged)

if(!isset($_SESSION['usr_id'])){          //if not a logged user
    $_SESSION['redir']=curPageURL();//Saving the current page for the redirection
    header('Location: ../Session/loginFrm.php'); 
}

and in loginFrm.php, we do:

{...after validation}    
if(isset($_SESSION['redir'])){
        header('Location: '.$_SESSION['redir']);
    }else{...}

in this page, they say we should use something like this instead:

 ...
    require_once '../Session/loginFrm.php';
    exit();

This doesn't work for me, the session variable now contains the included page, and not the current page.

What do you think about?

© Stack Overflow or respective owner

Related posts about php

Related posts about validation