Author Topic: [function.session-start]: problem  (Read 699 times)

Offline Killer2

  • Level 4
  • *
  • Posts: 13
  • Reputation: +0/-0
    • View Profile
[function.session-start]: problem
« on: August 25, 2007, 12:21:09 PM »
I got the following problem. Only in index.php (nowhere else)


Warning: session_start() [function.session-start]: Cannot send session cache limiter - headers already sent (output started at /home/killer/public_html/index.php:5) in /home/killer/public_html/index.php on line 7

That is what you see when you are in my index.php. The game somehow still works. And your session is available everywhere. Even your status (that is displayed in index.php) is correct. You just see that piece of text which is annoying.
 
These are the first 15 lines of index.php:
Code: [Select]
<html>
<title>mmorpg</title>
<META NAME="description" CONTENT="browser based game">
<META NAME="keywords" CONTENT=" browser">
<META NAME="robot" CONTENT="index,follow">
<META NAME="author" CONTENT="Killer">
<META NAME="revisit-after" CONTENT="7">
</html>
<?php
include 'connect.php';
session_start();
if (isset(
$_SESSION['player'])) 
  {
    
$player=$_SESSION['player'];
    
$userstats="SELECT * from Bleach_users where playername='$player'";

Offline Zeggy

  • Global Moderator
  • Level 35
  • *****
  • Posts: 1,187
  • Reputation: +13/-4
    • View Profile
Re: [function.session-start]: problem
« Reply #1 on: August 25, 2007, 01:36:16 PM »
session_start() needs to be called before you show anything on the page, so try this:

Code: [Select]
<?php
include 'connect.php';
session_start();
?>

<html>
<title>mmorpg</title>
<META NAME="description" CONTENT="browser based game">
<META NAME="keywords" CONTENT=" browser">
<META NAME="robot" CONTENT="index,follow">
<META NAME="author" CONTENT="Killer">
<META NAME="revisit-after" CONTENT="7">
</html>
<?php
if (isset($_SESSION['player'])) 
  {
    
$player=$_SESSION['player'];
    
$userstats="SELECT * from Bleach_users where playername='$player'";

Offline Killer2

  • Level 4
  • *
  • Posts: 13
  • Reputation: +0/-0
    • View Profile
Re: [function.session-start]: problem
« Reply #2 on: August 25, 2007, 03:58:23 PM »
Thanks. It worked (by that I mean no irritating text  :) , the session itself worked before).

 


SimplePortal 2.3.3 © 2008-2010, SimplePortal