Reply to Yet Another "session_start() Cannot send session cache limiter - headers already sent" Question

Your name:

Reply:


Posted by three-eight-hotel on 03/30/07 20:27

I'm somewhat of a newbie to PHP coding, but have developed a site
using the technology, and have been pleasantly surprised by the
capabilities offered. I am more comfortable in the ASP world, however
and am really struggling with managing sessions in PHP, based on my
experiences with managing sessions in ASP.

99.9% of the feedback I have seen when dealing with the errors has
referred to having whitespace before the <?php or after the ?>. I
have opened my source in several different editors and can't find that
to be the case with my code. Aside from having general issues with
the basic methodology in which I am managing sessions, I am completely
perplexed as to why I am getting these errors, from time to time...

For those who might have recommendations on an overall session
management strategy, I basically want to allow my user to come into my
site, through any page that might be bookmarked. Not all pages are
going to require a session, but they may be required to have a session
value set in order to perform certain administrative functions (which
requires a successful login), so I would need to check for the
existence of a session value and log them in and set it, if it doesn't
exist...

Now to my specific problem...

I have an include page called master_session.php, which looks like
this (no whitespaces before or after php tags):
=================================
<?php
if (! isset($ADMIN_session)) {
ob_start();
ob_clean();
session_start();
session_register("ADMIN_session");
}
?>
=================================

I have a login page, which looks like this (no whitespace before the
include of master_session)
=================================
<?php require_once($_SERVER['DOCUMENT_ROOT'].'/common/includes/
master_session.php'); ?>
<?php if ($content_identifier == false){
$content_identifier = 'parish';}?>
<? $page_title = "Administration"; ?>
<?php require_once($_SERVER['DOCUMENT_ROOT'].'/common/includes/
master_header.php'); ?>
<?php require_once($_SERVER['DOCUMENT_ROOT'].'/common/includes/
master_nav.php'); ?>
<?php require_once($_SERVER['DOCUMENT_ROOT'].'/common/includes/
bg100.php'); ?>
<!----CONTENT AREA -- PLACE INCLUDE PATH AND FILE NAME BELOW---->
<form name="criteria_form" action="adminvalidation.php" method="post">
<table height="100%" border="0" width="81%" align="center"
background="/common/bkgrnds/bg100.gif"">
<tr>
<td colspan="2" height="40">&nbsp;</td>
</tr>
<? if (${"login"} == "invalid")
echo "The username/password you have entered is invalid, or you do
not have privileges to perform administrative functions. If you feel
you've received this message in error, please contact your system
administrator.";
?>
<tr>
<td colspan="2" align="center"><strong>Please Login</strong></
td>
</tr>
<tr>
<td colspan="2" height="40">&nbsp;</td>
</tr>
<tr>
<td align="right">Username&nbsp;</td>
<td><input type="text" name="user_nm" size="8" maxlength="8">
</td>
</tr>
<tr>
<td align="right">Password&nbsp;</td>
<td><input type="password" name="password" size="10"
maxlength="10">
</td>
</tr>
<tr>
<td colspan="2" height="40">&nbsp;</td>
</tr>
<tr>
<td colspan="2" align="center"><input type="submit"
name="Submit" value="Submit">
</td>
</tr>
<tr>
<td><input type="hidden" name="content_identifier" value="<?echo
${content_identifier}?>"></td>
</tr>
</table>
</form>
<!----END CONTENT AREA --- NO CHANGES BELOW THIS LINE-------->
<?php require_once($_SERVER['DOCUMENT_ROOT'].'/common/includes/
master_footer.php'); ?>
==============================================

master_header.php is where my HTML code starts:
========================
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>

etc...................
========================


Is there anything in here that jumps out at anyone, as to why I'm
getting the error? The exact error is:

Warning: session_start() [function.session-start]: Cannot send session
cache limiter - headers already sent (output started at /home/holytrin/
public_html/common/admin/admin.php:2) in /home/holytrin/public_html/
common/includes/master_session.php on line 4

btw.. I do an ob_end_flush() in the master_footer.php file, on the
very last line...

Any help would be greatly appreciated!!!

Best Regards,
Todd

[Back to original message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация