Jump to content

Recommended Posts

Hi All,

 

Im building a web site and for that im in need to create sessions.

 

when ever im using the following code.. I keep getting the warning which is given afterwards.

 

code:

session_start();

include('session.php');

 

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

header('Location: login.php');

}

 

warning:

 

Warning: session_start() [function.session-start]: Cannot send session cookie - headers already sent by (output started at E:\Program Files\xampp\htdocs\cse\event_coord_home.php:1) in E:\Program Files\xampp\htdocs\cse\event_coord_home.php on line 3

 

Warning: session_start() [function.session-start]: Cannot send session cache limiter - headers already sent (output started at E:\Program Files\xampp\htdocs\cse\event_coord_home.php:1) in E:\Program Files\xampp\htdocs\cse\event_coord_home.php on line 3

 

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

 

 

 

can some one please help me this. I cant find a reason for this..

 

Cheers,

Thank you

 

Link to comment
https://forums.phpfreaks.com/topic/182760-session-handling-errors/
Share on other sites

You should have checked the topic on header errors: here.

 

What it means is that there's already output sent to the browser. Call the session header before PHP outputs any html. The problem here occurs for both session_start() and the header() function, rewrite your code if you want to use header() to redirect your user.

 

For a quick solution look at ob_start, although this isn't the way you should structure your code!

 

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.