Well, I've just scanned previous posts on this board and it seems that others have had similar problems. Some of the answers have been along the lines of what I was thinking of, but I can't see anywhere where there might be any output to the browser before session_start() is reached.
To clarify, the code (copied from a tutorial) is as follows. Maybe I mistyped something ...
db.php ...
<?php
// db.php
//Database functions for easier site maintainance
//Set default developer access
$dbhost = "localhost";
$dbuser = "tourists_devuser";
$dbpass = "aaliyah";
//dbConnect: Connects to specified database.
//Param: Database Name (optional)
function dbConnect($db="") {
//Import the scope of the globals so that they can be accessed from within the function
global $dbhost, $dbuser, $dbpass;
$dbcnx = @mysql_connect($dbhost, $dbuser, $dbpass)
or die ("The site database appears to be down.");
if ($db !="" and !@mysql_select_db($db))
die ("The site database is unavailable");
return $dbcnx;
}
?>
common.php ...
<?php
// common.php
function error($msg) {
?>
<html>
<head>
<script language="javascript">
<!--
alert("<?=$msg?>");
history.back();
//-->
</script>
</head>
<body>
</body>
</html>
<?
exit;
}
?>
The start of accesscontrol.php ...
<?php
// accesscontrol.php
include_once 'common.php';
include_once 'db.php';
//Start the session
session_start();