Re: Using header(location: ......php) within a class not working
- From: Robin <anon@xxxxxxxxxxxxx>
- Date: Wed, 20 Feb 2008 11:35:31 +0000
ajtrichards@xxxxxxxxxxxxxx wrote:
Hi.
Can someone tell me why this code is not working?
<?php
session_start();
class tta_globals {
function check_session_state(){
if(!$_SESSION['logged_in']){
header('Location: login.php');
die();
}
}
}
$tta_globals = new tta_globals();
$tta_globals -> check_session_state();
?>
When I run this code it doesn't redirect the user? I have checked and
double checked to make sure that there is no session['logged_in']
anywhere.
Can anyone help?
Regards,
Alex.
Ajtrichards Web Solutions
http://www.ajtrichards.co.uk
Are you sure that you have no output (even whitespace) prior to the header call? Headers have to be sent before any other output.
Robin
.
- References:
- Using header(location: ......php) within a class not working
- From: ajtrichards@xxxxxxxxxxxxxx
- Using header(location: ......php) within a class not working
- Prev by Date: Re: Advantages and disadvantages of PHP?
- Next by Date: Re: Different MSSQL output date format from the same PHP script
- Previous by thread: Re: Using header(location: ......php) within a class not working
- Next by thread: Re: Using header(location: ......php) within a class not working
- Index(es):
Relevant Pages
|