Page 1 of 1

Issues with frames and sessions

Posted: Wed May 26, 2010 7:40 am
by wro
Hello, I am using two frames, one for navigation and the other for content. The navigation will display news and other information if there is not a session set, the content, once logged in will set the session then reload the menu frame, however it is displaying the following error:

Warning: session_start() [function.session-start]: Cannot send session cache limiter - headers already sent (error on line 2 [session_start()]

Code: Select all

<php
session_start();
include 'connect.php';
?>
<?php
if (isset($_SESSION['player'])) 
  {
    echo "<a href=\"overview.php\" target=\"content\"><p align=\"center\">Overview</p></a>";
    echo "<a href=\"town.php\" align=\"center\" target=\"content\"><p align=\"center\">Town</p></a>";
    echo "<a href=\"charsheet.php\" align=\"center\" target=\"content\"><p align=\"center\">Character Sheet</p></a>";
    echo "<a href=\"skills.php\" align=\"center\" target=\"content\"><p align=\"center\">Skills</p></a>";
    echo "<a href=\"market.php\" align=\"center\" target=\"content\"><p align=\"center\">Market</p></a>";
    echo "<a href=\"guild.php\" target=\"content\"><p align=\"center\">Guild Hall</p></a>";
    echo "<p align=\"center\"><img src=\"images/standard.jpeg\" align=\"middle\"></p>";
    echo "<p align=\"center\">HP: xxx/xxx</p>";
    echo "<p align=\"center\">IP: xxx/xxx</p>";
  }
else
  {
    echo "<h2>News:</h2>";
    echo "<p>Frame and menu added 05-26-2010</p>";
    echo "<p>Registration live 05-18-2010</p>";
}
?>
Snippet from the authentication page.

Code: Select all

if($result2)
    {
       session_start();
       $_SESSION['player']=$player;
       print "logged in successfully<br><br>";
       print "<A href='content.php'>Play!</a>";
       print("<script language ='javasript'>top.menu.locatin.reload();</script>");   
    }

Re: Issues with frames and sessions

Posted: Wed May 26, 2010 7:46 am
by Weirdan

Re: Issues with frames and sessions

Posted: Wed May 26, 2010 7:55 am
by wro
Sorry, I suppose I should have noted that I had already searched for the solution, as you can see from the code, there is no white space before the session_start, and I believe the problem may be that I'm trying to implement the same session in both frames? I've tried naming the sessions but that didn't work either and I'm feeling a bit stuck.