Jump to content

[SOLVED] Session & header errors


cfgcjm

Recommended Posts

I'm getting this error:

Warning: session_start() [function.session-start]: Cannot send session cache limiter - headers already sent (output started at /home/digiconm/public_html/Homeplate/portal/jcheck.php:1) in /home/digiconm/public_html/Homeplate/portal/jcheck.php on line 3

 

Warning: Cannot modify header information - headers already sent by (output started at /home/digiconm/public_html/Homeplate/portal/jcheck.php:1) in /home/digiconm/public_html/Homeplate/portal/jcheck.php on line 9

 

 

I get it after i've logged in and i click a link to a file jcheck.php which is this code:

<?php
/* Is User Logged In? */
session_start();
// this is just your every day page where you would want someone logged in to view the info
if ($_SESSION['loggedin'] == TRUE) 
{ // user is logged in
	if($_SESSION['client']==1)
		{
	header("location:ejournal.php"); 
			exit;
		}
	if($_SESSION['client']==0)
		{
	header("location:nojournal.php");
			exit;
		}
}
elseif ($_SESSION['loggedin'] == FALSE) { // user is not logged in
	header("location:reject.php");
      exit;
}
?>

 

anyone know why

Link to comment
Share on other sites

Ok i think i found my problem but i dont know how to fix it... this is what i need my final code to be:

<?php
/* Is User Logged In? */
session_start();
if ($_SESSION['loggedin'] == true) { // user is logged in
print 'You are logged in';
if($_SESSION['client']==1)
	{
	header("location:journal.php");
	exit;
	}
if($_SESSION['client']==0)
	{
	header("location:nojournal.php");
	exit;
	}

} elseif ($_SESSION['loggedin'] == false) { // user is not logged in
header("Location:reject.php");
      exit;
}

?>

 

and it works until i add more than one occurrence of header()...if i replace header with print' appropriate message'; it works fine...is there anyway to fix this... it gives me these two errors depending on the case

 

Warning: Cannot modify header information - headers already sent by (output started at /home/digiconm/public_html/Homeplate/portal/jcheck.php:5) in /home/digiconm/public_html/Homeplate/portal/jcheck.php on line 13

 

or

 

Warning: Cannot modify header information - headers already sent by (output started at /home/digiconm/public_html/Homeplate/portal/jcheck.php:5) in /home/digiconm/public_html/Homeplate/portal/jcheck.php on line 8

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.