Jump to content

Header Problem Clarrification


dtrm_mora

Recommended Posts

Hi,,

 

I have read earlier posts regarding this.. but here is my problem.

code:

<?php

header('Location: login.php');

?>

 

This is the only piece of code my in my page. There is no output here. But it gives a warning

 

warning:

Warning: Cannot modify header information - headers already sent by (output started at E:\Program Files\xampp\htdocs\cse\company-home-page.php:1) in E:\Program Files\xampp\htdocs\cse\company-home-page.php on line 3

 

company-home-page is the name of the page...

 

What seems to be the problem..

Thank you

Link to comment
Share on other sites

yes i have...

 

here is the page that i want to handle.. Please help me with this..

 

"

<?php

session_start();

if($_SESSION['type']!="comp"){

header('Location: login.php');

}

?>

<html>

<head>

<meta http-equiv="content-type" content="text/html; charset=utf-8" />

<title><?php //include('title.php');?></title>

<meta name="keywords" content="" />

<meta name="description" content="" />

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

</head>

<body>

<!-- start header -->

<div id="header">

<h1><strong><?php include('site_header.php');?> </strong></h1>

<p><?php include('sub_header.php');?></p>

</div>

<!-- end header -->

<!-- start page -->

<div id="wrapper">

<div id="page">

<!-- start content -->

<div id="content">

<?php $today=date("d-m-Y");?>

 

<div class="post">

<h1 class="title">Company Home Page</h1>

<p class="byline"><?php  echo $today. " "; ?>Welcome - <?php echo $_SESSION['username']."  ";?>  | <a href="logout.php">logout</a></p>

<div class="entry">

<p><strong>Black Eyed Susan </strong> is a free template from <a href="http://freecsstemplates.org/">Free CSS Templates</a> released under a <a href="http://creativecommons.org/licenses/by/2.5/">Creative Commons Attribution 2.5 License</a>. The flower photo is fromt <a href="http://www.pdphoto.org/">PDPhoto.org</a>. You're free to use this template for both commercial or personal use. I only ask that you link back to <a href="http://freecsstemplates.org/">my site</a> in some way. Enjoy :)</p>

<p> </p>

<p>Maecenas pede nisl, elementum eu, ornare ac, malesuada at, erat. Proin gravida orci porttitor enim accumsan lacinia. Donec condimentum, urna non molestie semper, ligula enim ornare nibh, quis laoreet eros quam eget ante. Maecenas pede nisl, elementum eu, ornare ac, malesuada at, erat. </p>

</div>

<p class="meta"><a href="#" class="more">Read More</a></p>

</div>

<div class="post">

<h2 class="title">Risus Pellentesque</h2>

<p class="byline">Posted on August 25th, 2007 by <a href="#">admin</a> | <a href="#">Edit</a></p>

<div class="entry">

<p>Maecenas pede nisl, elementum eu, ornare ac, malesuada at, erat. Proin gravida orci porttitor enim accumsan lacinia. Donec condimentum, urna non molestie semper, ligula enim ornare nibh, quis laoreet eros quam eget ante. Maecenas pede nisl, elementum  malesuada at, erat. Proin gravida orci porttitor enim accumsan lacinia. </p>

</div>

<p class="meta"><a href="#" class="more">Read More</a></p>

</div>

</div>

<!-- end content -->

<!-- start sidebar -->

<div id="sidebar">

<ul>

<li>

<?php include('top_menu.php');?>

</li>

<li>

<h2>Resources</h2>

<ul>

<?php include('resources_menu.php');?>

</ul>

</li>

<li>

<h2>Management</h2>

<ul>

<?php include('management_menu.php'); ?>

</ul>

</li>

</ul>

</div>

<!-- end sidebar -->

</div>

<div style="clear:both"> </div>

</div>

<!-- end page -->

<div id="footer">

<p><?php include('footer.php');?></p>

</div>

</body>

</html>

"

thanks

 

Link to comment
Share on other sites

there are two things in my mind you can try first clear your cookies it happens to me sometime before and when i cleared all goes well next better solution is to add ob_start(); at very top of your page before any thing, and ob_end_flush(); at very end of your file.

Link to comment
Share on other sites

Based on the line number where the error is occurring (line 3), you have at least one carriage-return/line-feed before the <?php tag.

 

You cannot have any characters in your file before the <?php tag when you have a session_start() or a header() in your code. This includes, but is not limited to - a space, a tab, a carriage-return/line-feed, a doctype declaration, any other HTML, any other printing or non-printing characters, or the BOM (Byte Order Mark) characters that some editors place at the start of a file saved as UTF-8 format.

 

Link to comment
Share on other sites

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.