Jump to content

[SOLVED] Cannot modify header information - headers already sent


Recommended Posts

Have no problem with this on any of my other pages, have checked for white space and even unformatted it to check and put it into Notepad instead of TextPad but no joy there. Dont know if its anything to do with cookies, any help much apreciated.

 

Errors:

 

Warning: Cannot modify header information - headers already sent by (output started at C:\wamp\www\include\header.php:7) in C:\wamp\www\log_out.php on line 9

 

Warning: Cannot modify header information - headers already sent by (output started at C:\wamp\www\include\header.php:7) in C:\wamp\www\log_out.php on line 10

 

Header.php

 

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">

<head>

<title></title>

<link type="text/css" href="style.css" rel="stylesheet" media="screen" />

<meta http-equiv="content-type" content="text/html; charset=iso-8859-1" />

<meta name="resource-type" content="document" />

</head>

<body>

 

<div id="container">

<div id="header">

<div class="header01"></div>

<div class="header02">

<div id="header_text">

<?php

if (!isset($_COOKIE['cookie_user']) && !isset($_COOKIE['cookie_pass']))

{

?>

Login

<form method="POST" action="log_in.php">

Username <input type="text" name="frm_user" id="frm_user" size="20" /><br />

Password <input type="password" name="frm_pass" size="20" /><br />

<input type="submit" value="Submit" name="sub" />

<input type="reset" value="Reset" name="res" />

</form>

 

<a href='register.php'>Register</a>

<a href='password.php'>Lost Password?</a><br />

 

<?php

}

else

{

$user = $_COOKIE['cookie_user'];

echo "<h3>Welcome Back</h3>";

echo "<h4>$user</h4>";

echo "<h4><a href='log_out.php'>Log Out</a></h4>";

}

?>

</div>

</div>

<div class="header03"></div>

</div>

 

log_out.php

 

<?php

include('include/header.php');

include('include/menu.php');

 

 

$time = time();

if (isset($_COOKIE['cookie_user']) && isset($_COOKIE['cookie_pass']))

{

setcookie ("cookie_user", "", $time - 300000);

setcookie ("cookie_pass", "", $time - 300000);

echo "<h1>Log Out</h1>";

echo "<p>All Cookies Cleared</p>";

echo "<p><a href='index.php'>Back to Home</a></p>";

}

 

include('include/side.php');

include('include/footer.php');

?>

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.