Jump to content

Header issue


circpros

Recommended Posts

Hello....

 

I am basically familiar with PHP, but mostly from taking existing code and tweaking it for my uses.... this issue is related to just such a venture...

 

I use an outdated and heavily hacked up phpbb2 board to serve formatted posts through a syndication script, syndicating the data to various places around my site. The script worked great for a few years, but I was doing some updating of some elements and screwed up and overwrote the main site. When I have tried to duplicate the previous function, I am getting 'headers already sent' errors.

 

Here are the errors:

 

Warning: Cannot modify header information - headers already sent by (output started at /home/website/public_html/index.php:6) in /home/website/public_html/listings/includes/sessions.php on line 254

 

Warning: Cannot modify header information - headers already sent by (output started at /home/website/public_html/index.php:6) in /home/website/public_html/listings/includes/sessions.php on line 255

 

Here is the block of code that is producing the error:

 

<?php
$phpbb_root_path = './listings/';
define ('IN_PHPBB', true);
if (!file_exists($phpbb_root_path . 'extension.inc'))
{
die ('<tt><b>phpBB Fetch All:</b>
	$phpbb_root_path is wrong and does not point to your forum.</tt>');
}
include_once ($phpbb_root_path . 'extension.inc');
include_once ($phpbb_root_path . 'common.' . $phpEx);
include_once ($phpbb_root_path . 'includes/bbcode.' . $phpEx);
include_once ($phpbb_root_path . 'mods/phpbb_fetch_all/common.' . $phpEx);
include_once ($phpbb_root_path . 'mods/phpbb_fetch_all/posts.' . $phpEx);
[b]$userdata = session_pagestart($user_ip, PAGE_INDEX);
init_userprefs($userdata);
[/b]$news = phpbb_fetch_posts();
phpbb_disconnect();
?>
<?php
for ($i = 0; $i < count($news); $i++) {
?>
Posted: 
<?php echo $news[$i]['date']; ?>
<h2>
<?php echo $news[$i]['topic_title']; ?>
</h2>
<br>
<?php echo $news[$i]['post_text']; ?>
<hr size="1"/>
<p />
<?php

}

?>

 

I'm thinking that the issue is related to the session management request (bold in the code), but I am not sure, and even if it is, I can't figure out the correction to resolve the error....

 

Any help would be greatly appreciated. I can provide any additional info that might help you help me :).

 

Link to comment
https://forums.phpfreaks.com/topic/186120-header-issue/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.