1. Advertising
    y u no do it?

    Advertising (learn more)

    Advertise virtually anything here, with CPM banner ads, CPM email ads and CPC contextual links. You can target relevant areas of the site and show ads based on geographical location of the user if you wish.

    Starts at just $1 per CPM or $0.10 per CPC.

Warning: Cannot modify header information - on my blog

Discussion in 'PHP' started by bbrian017, Jun 12, 2008.

  1. #1
    Does anyone know what this error is about,

    Warning: Cannot modify header information - headers already sent by (output started at /home/content/b/b/r/bbrian017/html/casinofiery/wp-content/themes/ClassicPoker/functions.php:8) in /home/content/b/b/r/bbrian017/html/casinofiery/wp-includes/pluggable.php on line 694
    Code (markup):
    I get the error when I visit the website using www. but when I don't use the www. the error doesn't show up.


    Any advice?
     
    bbrian017, Jun 12, 2008 IP
  2. jestep

    jestep Prominent Member

    Messages:
    3,659
    Likes Received:
    215
    Best Answers:
    19
    Trophy Points:
    330
    #2
    My guess is that the script is trying to redirect or set a header when some output has been already been sent to the browser.

    What's in ClassicPoker/functions.php on line 8?
     
    jestep, Jun 12, 2008 IP
    bbrian017 likes this.
  3. tomazinis

    tomazinis Peon

    Messages:
    30
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    0
    #3
    You already made output before header command. Remove ouput.
     
    tomazinis, Jun 12, 2008 IP
    bbrian017 likes this.
  4. bbrian017

    bbrian017 Well-Known Member

    Messages:
    2,990
    Likes Received:
    66
    Best Answers:
    0
    Trophy Points:
    170
    #4
    I personally didn't add anything to the functions.php I'm assuming it's an error from when this free template was designed?

    Anyone have a clue how to fix this?

    this is the functions.php file here,

    <?php
    
    function mysql2date( $dateformatstring, $mysqlstring, $translate = true ) {
    	global $wp_locale;
    	$m = $mysqlstring;
    	if ( empty( $m ) )
    		return false;
    
    	if( 'G' == $dateformatstring ) {
    		return gmmktime(
    			(int) substr( $m, 11, 2 ), (int) substr( $m, 14, 2 ), (int) substr( $m, 17, 2 ),
    			(int) substr( $m, 5, 2 ), (int) substr( $m, 8, 2 ), (int) substr( $m, 0, 4 )
    		);
    	}
    
    	$i = mktime(
    		(int) substr( $m, 11, 2 ), (int) substr( $m, 14, 2 ), (int) substr( $m, 17, 2 ),
    		(int) substr( $m, 5, 2 ), (int) substr( $m, 8, 2 ), (int) substr( $m, 0, 4 )
    	);
    
    	if( 'U' == $dateformatstring )
    		return $i;
    
    	if ( -1 == $i || false == $i )
    		$i = 0;
    
    	if ( !empty( $wp_locale->month ) && !empty( $wp_locale->weekday ) && $translate ) {
    		$datemonth = $wp_locale->get_month( date( 'm', $i ) );
    		$datemonth_abbrev = $wp_locale->get_month_abbrev( $datemonth );
    		$dateweekday = $wp_locale->get_weekday( date( 'w', $i ) );
    		$dateweekday_abbrev = $wp_locale->get_weekday_abbrev( $dateweekday );
    		$datemeridiem = $wp_locale->get_meridiem( date( 'a', $i ) );
    		$datemeridiem_capital = $wp_locale->get_meridiem( date( 'A', $i ) );
    		$dateformatstring = ' ' . $dateformatstring;
    		$dateformatstring = preg_replace( "/([^\\\])D/", "\\1" . backslashit( $dateweekday_abbrev ), $dateformatstring );
    		$dateformatstring = preg_replace( "/([^\\\])F/", "\\1" . backslashit( $datemonth ), $dateformatstring );
    		$dateformatstring = preg_replace( "/([^\\\])l/", "\\1" . backslashit( $dateweekday ), $dateformatstring );
    		$dateformatstring = preg_replace( "/([^\\\])M/", "\\1" . backslashit( $datemonth_abbrev ), $dateformatstring );
    		$dateformatstring = preg_replace( "/([^\\\])a/", "\\1" . backslashit( $datemeridiem ), $dateformatstring );
    		$dateformatstring = preg_replace( "/([^\\\])A/", "\\1" . backslashit( $datemeridiem_capital ), $dateformatstring );
    
    		$dateformatstring = substr( $dateformatstring, 1, strlen( $dateformatstring ) -1 );
    	}
    	$j = @date( $dateformatstring, $i );
    
    	/*
    	if ( !$j ) // for debug purposes
    		echo $i." ".$mysqlstring;
    	*/
    
    	return $j;
    }
    
    
    function current_time( $type, $gmt = 0 ) {
    	switch ( $type ) {
    		case 'mysql':
    			return ( $gmt ) ? gmdate( 'Y-m-d H:i:s' ) : gmdate( 'Y-m-d H:i:s', ( time() + ( get_option( 'gmt_offset' ) * 3600 ) ) );
    			break;
    		case 'timestamp':
    			return ( $gmt ) ? time() : time() + ( get_option( 'gmt_offset' ) * 3600 );
    			break;
    	}
    }
    
    
    function date_i18n( $dateformatstring, $unixtimestamp ) {
    	global $wp_locale;
    	$i = $unixtimestamp;
    	if ( ( !empty( $wp_locale->month ) ) && ( !empty( $wp_locale->weekday ) ) ) {
    		$datemonth = $wp_locale->get_month( date( 'm', $i ) );
    		$datemonth_abbrev = $wp_locale->get_month_abbrev( $datemonth );
    		$dateweekday = $wp_locale->get_weekday( date( 'w', $i ) );
    		$dateweekday_abbrev = $wp_locale->get_weekday_abbrev( 
    Code (markup):
    I'm at work and had to use notepad to show this code. So I'm not too sure where line 8 is but I'm pretty sure I have added it here!
     
    bbrian017, Jun 12, 2008 IP
  5. Lordo

    Lordo Well-Known Member

    Messages:
    2,082
    Likes Received:
    58
    Best Answers:
    0
    Trophy Points:
    190
    #5
    Oh yes jestep is right on this: pluggable.php tries to redirect to the www-less URL. In order for this to get completely solved, you need to add rewrite rule in your htaccess that redirects www to www-less URL.

    RewriteCond %{HTTP_HOST} ^[url]www.casinofiery.com[/url] [NC] 
    RewriteRule ^(.*)$ http://casinofiery.com/$1 [R=301]
    Code (markup):
     
    Lordo, Jun 12, 2008 IP
    bbrian017 likes this.
  6. bbrian017

    bbrian017 Well-Known Member

    Messages:
    2,990
    Likes Received:
    66
    Best Answers:
    0
    Trophy Points:
    170
    #6
    oh jeepers what file do I add that too?

    RewriteCond %{HTTP_HOST} ^www.casinofiery.com [NC]
    RewriteRule ^(.*)$ http://casinofiery.com/$1 [R=301]
    Code (markup):
    P.S. I also get the error when I save or edit anything in the admin cp. the changes save but I still get this error!
     
    bbrian017, Jun 12, 2008 IP
  7. Lordo

    Lordo Well-Known Member

    Messages:
    2,082
    Likes Received:
    58
    Best Answers:
    0
    Trophy Points:
    190
    #7
    .htaccess file.
     
    Lordo, Jun 12, 2008 IP
  8. bbrian017

    bbrian017 Well-Known Member

    Messages:
    2,990
    Likes Received:
    66
    Best Answers:
    0
    Trophy Points:
    170
    #8
    I know I have issues with .htaccess access files using godaddy.

    I don't currently have one in my root folder do I simply create one
     
    bbrian017, Jun 12, 2008 IP
  9. Lordo

    Lordo Well-Known Member

    Messages:
    2,082
    Likes Received:
    58
    Best Answers:
    0
    Trophy Points:
    190
    #9
    Yes but you will need to add this as the first line:

    RewriteEngine ON
     
    Lordo, Jun 12, 2008 IP
  10. bbrian017

    bbrian017 Well-Known Member

    Messages:
    2,990
    Likes Received:
    66
    Best Answers:
    0
    Trophy Points:
    170
    #10
    Can I create this .htaccess file using notepad?

    and if so what do I save it as all files and a .php? I'm a little confused sorry...
    
    RewriteEngine ON
    RewriteCond %{HTTP_HOST} ^[url]www.casinofiery.com[/url] [NC]
    RewriteRule ^(.*)$ http://casinofiery.com/$1 [R=301]
    Code (markup):

    Like that?
     
    bbrian017, Jun 12, 2008 IP
  11. Lordo

    Lordo Well-Known Member

    Messages:
    2,082
    Likes Received:
    58
    Best Answers:
    0
    Trophy Points:
    190
    #11
    Yes. Most important: upload it in ascii mode.
     
    Lordo, Jun 12, 2008 IP
  12. bbrian017

    bbrian017 Well-Known Member

    Messages:
    2,990
    Likes Received:
    66
    Best Answers:
    0
    Trophy Points:
    170
    #12
    I uploaded the file but I'm sure I didn't do it correctly.

    Any ideals?
     
    bbrian017, Jun 12, 2008 IP