php - Header in the top -


at time need 2 view pages in 1 page. in session this:

       <?php         session_start();         if(isset($_session['login_id']) && !empty($_session['login_id'])){                   ?>           ///my html code///         <?              }             else {         ?>           //diffetent view here//         <?              }             require_once('../libraries/config/configpdo.php');         ?> 

but need make become 1 page , redirect if not logged in.

       <?php         session_start();         if(isset($_session['login_id']) && !empty($_session['login_id'])){                   ?>           ///my html code///         <?              }             else {header("location: login.php");         ?>          <?              }             require_once('../libraries/config/configpdo.php');         ?> 

but see, put header redirect @ bottom of page.

how make simple, set header location in top of page.

try -

session_start(); if(empty($_session['login_id'])){      header("location: login.php");     exit; } else {     //html } 

Comments

Popular posts from this blog

matlab - "Contour not rendered for non-finite ZData" -

javascript - Any ideas when Firefox is likely to implement lengthAdjust and textLength? -

delphi - Indy UDP Read Contents of Adata -