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:
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 .