View Single Post
Old 10-22-2008, 01:53 PM   #11 (permalink)
Hudson
The Wanderer
 
Hudson's Avatar
 
Join Date: Sep 2008
Posts: 8
Thanks: 1
Hudson is on a distinguished road
Default

Argh, this is getting annoying now.

I'm trying to bounce users back to ../index2.php if they come to the secure area without logging in

At the top of my .com/secure/index.php file I've got an include that pulls in the following file to check if a user is authorised

PHP Code:
<?php
session_start
();

ini_set('display_errors',1);
error_reporting (E_ALL & ~E_NOTICE);

    
// Check the session to see if it's been set
    
if (isset($_SESSION['sess_userName'])) {
        } 
// Don't do anything cos the user has logged in.
        
else {
            
header("Location: ../index2.php");
            exit;
        }
?>
I'm getting an error which says (obviously edited certain info )

Quote:
Warning: Cannot modify header information - headers already sent by (output started at /***/***/***/***/***/***.com/***/***/secure/index.php:1) in /***/***/***/***/***/***.com/***/***/includefolder/checkauth.php.inc on line 11
Now then, a quick Google of this error reveals that it's usually caused by content (either real content or whitespace) being sent to the browser before the header() function.

However, I'm calling this include at the very start of the secure/index.php page like this

HTML Code:
<?php include("../includefolder/checkauth.php.inc"); ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
So as far as I can see there's no whitespace in there. I've also removed any whitespace from the checkauth.php.inc file without any luck.

I've spent the best part of the day trying to sort this, and I can't figure it out for the life of me.

Any help would be appreciated. Ta.
Hudson is offline  
Reply With Quote