Hi all
I use a PHP file as a template for my site. Most of it is HTML but I have a menu which has dynamic functionality, and of course the page content varies.
Here's a brief version of my file
<?php
header("Cache-Control:no-cache");
session_start();
include 'database_funcs.php';
include 'page_funcs.php';
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<HTML>
<HEAD>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=ISO-8859-1">
<LINK href="style.css" rel="stylesheet" type="text/css">
<TITLE>blah blah</TITLE>
<BODY>
<DIV ID='content'>
<?php include $pagename;?>
</DIV>
<?php build_dynamicmenu();?>
</BODY>
</HTML>
The $pagename variable contains the name of a PHP file which consists of the specific content for that page. I have called my template 'layout.php'
So my index.php looks like this
<?php
$pagename = 'indexc.php'; // the specific content file
include 'layout.php';
?>
[code=php]
This works great, but some of my pages are only intended for authorised users. When they login I create a SESSION which includes a variable that determines which pages they can view. Therefore if they are not logged in they should not get to see secure pages. That also works fine.
However, to prevent someone going directly to one of the specific content pages......for example using the URL [url]http://www.mysite.com/indexc.php[/url] - I decided that in every content page I would use a custom function to check the SESSION to see if they are allowed to view the page. This causes a Warning message to be displayed, which reads.....
[QUOTE]Warning: Cannot modify header information.....[/QUOTE]
I know that this is because I have HTML outputted already, before the 'header' function.
My question is, I suppose, have I over-complicated this task ??
If not, how do you suppress Warnings !?
Hope this all makes sense
Rich