Warning: Cannot modify header information - headers already sent by (output started at /home/www/jami3EETh/splintercell/index2.php:15) in /home/www/jami3EETh/splintercell/membership/mo.php on line 13
I get the above error however i cannot think of anything i have overlooked....
My site is set up so that my first page that is displayed(index2.php) then referes to files in the directory ./pages/
So index2.php?welcome is the same as including ./pages/welcome/
so back to the error first of all i dont know how it is possible because i have session_start(); on the first line of code in index2.php
This is index2.php
<?php session_start();?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<link href="style.css" rel="stylesheet" type="text/css">
</head>
<body>
<div id="top">
<img src="images/lay_01.gif" width="1024" height="241">
</div>
<div id="nav">
<table cellspacing=0 cellpadding=0 width="136" border="0">
<tr>
<td width="136" height="29" background="images/nav_01.gif"> </td>
</tr>
<tr>
<td background="images/nav_02.gif"><?php include("navinfo.php")?> </td>
</tr>
</table>
</div>
<div id="fr">
<table width="500" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="500" height="29" background="images/fr_01.gif"> </td>
</tr>
<tr>
</td>
</tr>
<tr>
<td width="500" height="8" background="images/fr_03.gif"><?php
$page = basename($_SERVER['QUERY_STRING']);
if(!$page){
include('pages/abilities.php');
} else {
if(file_exists('pages/'.$page.'.php')){
include('pages/'.$page.'.php');
} else {
echo('This page does not exist!');
}
}
?></td>
</tr>
</table>
</div>
</body>
</html>
then welcome.php is
<?php include("membership/mo.php"); ?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head><body>
Welcome <?php print("$member");?>
</body>
</html>
and mo.php is
<?php
// For register_global on PHP settings
$member = $_COOKIE['member'];
if (empty($member) || !isset($member)) // fail to read the browser cookie
{
// Try to read session
if (empty($_SESSION['member']) || !isset($_SESSION['member']))
{
header("Location: index2.php?login"); // redirect user to login
exit;
}
else
{
$member = $_SESSION['member'];
}
}
// MySQL Connection Variables
// Fill in your values for the next 4 lines
$hostname='localhost';
$user='jami3EETh'; //'user name for MySQL database';
$pass='******'; //'Password for database';
$dbase='jami3EETh'; //'database name';
$connection = mysql_connect("$hostname" , "$user" , "$pass") or die ("Can't connect to MySQL");
$db = mysql_select_db($dbase , $connection) or die ("Can't select database.");
// User has login but you should check his account validity again
$qChk = "select id from membership where name='$member' and status='Y' ";
$rsChk = mysql_query($qChk);
if (mysql_num_rows($rsChk) != '1')
{
session_destroy();
// make the cookie expires instantly.
setcookie ("member",$member,time()-1957240,"/");
header("Location: index2.php?login");
exit;
}
?>
My url is
http://www.jami3.co.uk/splintercell/index2.php
http://www.jami3.co.uk/splintercell/index2.php?welcome