Jump to content

Cannot modify header information


runnerjp

Recommended Posts

Hey guys im getting the error Warning: Cannot modify header information - headers already sent by (output started at /home/kylegray/public_html/include/authenticate.php:12) in /home/kylegray/public_html/home.php on line 7

 

Any idea why this is coming up. I think its something to to with me setting the cookie setcookie("un", $id); but im not sure.

 

home.php

<?
include("include/config.php");
//$_SESSION["backpage"]=$_SERVER['PHP_SELF'];
if($_SESSION["client_log"]!="true"){
	session_unregister("MemberArea");
	header("Location: index.php?redirect=".basename($_SERVER['PHP_SELF']));
	exit();
}
?>

 

 

 

 

authenticate.php

 

<?php 
include("include/required.php");
include("include/pagedetails.php");
include_once("include/authenticate.php"); 
	$tblName = $tbluser;
	$id=$_SESSION["id"];
setcookie("un", $id);
$ImgPath="$CatImage/";
$ImgPathsing="$SingUPImage/";
?>

Link to comment
Share on other sites

output started at /home/kylegray/public_html/include/authenticate.php:12

 

^^^ The problem is the output that your code is sending at line 12 of include/authenticate.php. Since the second piece of code you posted is including include/authenticate.php, that's probably not the code for authenticate.php since it would be pointless for a file to include itself, it also doesn't have 12 lines to it. What's the actual code for include/authenticate.php?

 

Also, session_unregister was depreciated 10 years ago, throws a depreciated error message in php5.3, and has been completely removed in php5.4 that was just released. You would instead unset the MemberArea $_SESSION variable.

Link to comment
Share on other sites

I fixed the error by removing the spaces!

 

but thankyou for this information Also, session_unregister() was depreciated 10 years ago, throws a depreciated error message in php5.3, and has been completely removed in php5.4 that was just released. You would instead unset() the MemberArea $_SESSION variable.

 

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.