session_start(); AHHH!

This is a discussion on "session_start(); AHHH!" within the PHP Forum section. This forum, and the thread "session_start(); AHHH! are both part of the Program Your Website category.



Go Back   Webforumz.com > Main Forums > Program Your Website > PHP Forum

Notices


Reply
 
LinkBack Thread Tools
  #1 (permalink)  
Old May 31st, 2007, 12:58
Junior Member
Join Date: May 2007
Location: United Kindom, London and the South East
Age: 17
Posts: 11
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to Bradster
session_start(); AHHH!

Im trying to make a login and admin panel for my site, and I get the following error on the login page;
Code: Select all
Warning:  session_start() [function.session-start]: Cannot send session cookie - headers already sent by (output started at /home/genosco/public_html/index.php:14) in /home/genosco/public_html/admin/index.php on line 2

Warning:  session_start() [function.session-start]: Cannot send session cache limiter - headers already sent (output started at /home/genosco/public_html/index.php:14) in /home/genosco/public_html/admin/index.php on line 2
And thus I cant even login, this the code I have for that page.
Code: Select all
<?php
session_start();
include("database.php");
include("login.php");
?>

<?php
if($logged_in){
   include('admin_body.php');
}else{
   displayLogin();
}
?>
Reply With Quote

  #2 (permalink)  
Old May 31st, 2007, 17:10
Reputable Member
Join Date: Jul 2005
Location: Melksham, Wilts, UK
Posts: 293
Thanks: 0
Thanked 0 Times in 0 Posts
Re: session_start(); AHHH!

Do you have anything (even a space or blank line) before the <?php, or have you posted your complete code here?
Reply With Quote
  #3 (permalink)  
Old Jun 2nd, 2007, 10:08
Reputable Member
Join Date: Apr 2007
Location: Scotland
Age: 17
Posts: 233
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to Blake121
Re: session_start(); AHHH!

First of all make sure that there is no space before the opening <?php

If there isn't do this "<?php session_start();" So that they are on the same line.
Reply With Quote
  #4 (permalink)  
Old Jun 2nd, 2007, 11:31
Reputable Member
Join Date: May 2006
Location: Northampton, UK
Posts: 399
Thanks: 0
Thanked 0 Times in 0 Posts
Re: session_start(); AHHH!

just make sure you put the session start code above the starting <html> tag in your code
Reply With Quote
Reply

Tags
not, session, start, working

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Similar Threads
Thread Thread Starter Forum Replies Last Post
session_start error gribble PHP Forum 7 Sep 18th, 2007 07:55


All times are GMT. The time now is 05:48.


Powered by vBulletin®
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.2.0 RC8
© 2003-2008 Webforumz.com : All Rights Reserved

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43