sessions error...

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
User avatar
spamyboy
Forum Contributor
Posts: 266
Joined: Sun Nov 06, 2005 11:29 am
Location: Lithuania, vilnius

sessions error...

Post by spamyboy »

HawleyJR | Please use

Code: Select all

and

Code: Select all

tags where appropriate when posting code. Read:  [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url][/color]

Code: Select all

Warning: session_start() [function.session-start]: Cannot send session cookie - headers already sent by (output started at C:\apache\xampp\htdocs\index.php:8) in C:\apache\xampp\htdocs\index.php on line 51

Warning: session_start() [function.session-start]: Cannot send session cache limiter - headers already sent (output started at C:\apache\xampp\htdocs\index.php:8) in C:\apache\xampp\htdocs\index.php on line 51
and here is line 51:

Code: Select all

<?php
session_start();
if($_SESSION['auth'] == true){
echo '<a href="index.php?page=logout">log out</a>';
}else{
    echo '<a href="index.php?page=login">login</a><span class="style4"> &bull;</span> <a href="index.php?page=register">register</a>';
}
?>
HawleyJR | Please use

Code: Select all

and

Code: Select all

tags where appropriate when posting code. Read:  [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url][/color]
User avatar
spamyboy
Forum Contributor
Posts: 266
Joined: Sun Nov 06, 2005 11:29 am
Location: Lithuania, vilnius

Post by spamyboy »

HawleyJR sorry ;/
User avatar
John Cartwright
Site Admin
Posts: 11470
Joined: Tue Dec 23, 2003 2:10 am
Location: Toronto
Contact:

Post by John Cartwright »

search on these forums for "headers already sent"
User avatar
raghavan20
DevNet Resident
Posts: 1451
Joined: Sat Jun 11, 2005 6:57 am
Location: London, UK
Contact:

Post by raghavan20 »

maku sure the php code is on the top of the php file....make sure these php lines are the first lines in the php code...as jcart says you can search for similar posts or you can google to find solutions to many similar problems.
Post Reply