Page 1 of 1

IF and page redirection

Posted: Wed Feb 07, 2007 4:54 am
by giles
Hi,

I’m not sure if i’m just getting myself confused here! I want to build a simple redirection along the lines of :

Code: Select all

<?php
require_once "siteDefaultsPage.inc";
	
	if (!INTERACTION_TEST){
	// redirect to new URL
	}
?>
in order to control access to a page. I’m getting caught up with the headders being sent from the .inc file - however, I need the .inc file to set the variable INTERACTION_TEST. Can you help?

Posted: Wed Feb 07, 2007 5:44 am
by garry27
try this and replace with the page you want

Code: Select all

header ("Location: login.php");

Posted: Wed Feb 07, 2007 5:45 am
by louie35

Code: Select all

if....(statement here){

    header("Location: your page");
    exit;

}//end if

Posted: Wed Feb 07, 2007 6:12 am
by superdezign
Be aware that you can't send any content before your header() call. Otherwise, javascript could easily redirect for you.