2

Possible Duplicate:
Headers already sent by PHP

<?php 
include_once 'session.php';
$uid='0';
error_reporting(E_ALL); ini_set('display_errors', 'On'); 
if($uid=='0' or empty($uid) or $uid=='')
{
header("Location:index.php");
exit;
}
include_once 'top.php';
?>

My session.php is as follows. It does not even output a word.

 <?php error_reporting(0);// Turn off all error reporting
if (!isset($_SESSION)) {
session_start();
}
if(isset($_SESSION['uid']))
{
    $uid=$_SESSION['uid'];
    $sid='0';
}
else
{
    $uid='0';
    $sid='0';
}
?>

In the above code, i get the error as follows

Warning: Cannot modify header information - headers already sent by 
(output started at /home/content/41/9717441/html/session.php:1) 
in /home/content/41/9717441/html/ask.php on line 7

Am i doing anything wrong in code?

Community
  • 1
  • 1
Swadesh Behera
  • 927
  • 9
  • 13

2 Answers2

3

maybe you have a space output in session.php before php open tag like this

 [space]<?php
 ....
MKT
  • 655
  • 1
  • 6
  • 18
0

session.php outputs something. You can't output the document's body before sending headers.