Jump to content

Headers already sent problem


upendra470

Recommended Posts

I have been running my project on localhost, it works perfectly fine. But as soon as I have uploaded on web i got two warnings.

 

Warning: session_start() [function.session-start]: Cannot send session cache limiter - headers already sent (output started at /home/gal37542/public_html/control/_includes/header.html:8) in /home/gal37542/public_html/control/session.php on line 2

 

Warning: Cannot modify header information - headers already sent by (output started at /home/gal37542/public_html/control/_includes/header.html:8) in /home/gal37542/public_html/control/session.php on line 34

 

Here my header.html file

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
<head>
<title>Control Panel for IHROYDC</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<meta name="Galaxias" content="cpanel " />
<meta name="description" content="Cpanel for IHROYDC" />
<link rel="stylesheet" href="style.css" type="text/css" />
</head>

<body>

<div id="header">International Human Rights Organization<div class="header">Control Panel for IHROYDC Official Website</div></div>

<div id="menu">
<div class="menu"><a href="home.php">home</a></div><div class="menu"><a href="user.php">User</a></div><div class="menu"><a href="news.php">News</a></div>
<div class="menu"><a href="gallery.php">gallery</a></div><div class="menu"><a href="testimonials.php">Testimonials</a></div><div class="menu"><a href="events.php">Events</a></div><div class="menu"><a href="legaladvice.php">Legal Advice/Complaints</a></div><div class="menu"><a href="casestudies.php">Case Studies</a></div><div class="menu"><a href="sendmail.php">send mail</a></div>
</div>

 

 

and here is session.php

<?php
session_start();
if (isset($_SESSION['valid_user']))
{
echo '<h3>You are logged in as: '.$_SESSION['valid_user'].'</h3>';
echo '<h1 align = "right"><a href = "logout.php">Logout </a></h1>';
$now = time();
$limit = $now - 60 * 10;
if (isset ($_SESSION['last_activity']) && $_SESSION['last_activity'] < 

$limit) {
	 // if too old, clear the session array and redirect
	 $_SESSION = array();
	 header('Location: index.html');
  exit;
} 
else {
  		// otherwise, set the value to the current time
  	$_SESSION['last_activity'] = $now;
}



}
else
{
if(isset($username))
{
echo 'Could not log you in';
}
else
{
header("location:access-denied.php");
}
}
?>    

 

Please tell me asap. Any info will be of great help!!

Link to comment
https://forums.phpfreaks.com/topic/241707-headers-already-sent-problem/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.