Unable to add cookies, header already sent.

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Zer
    New Member
    • May 2008
    • 12

    Unable to add cookies, header already sent.

    my board gets this at the beginning of the site "" found at http://hypboard.com and when i try to click any of the forums I get:

    Unable to add cookies, header already sent.
    File: /home/hypboard/public_html/includes/config.php
    Line: 1


    Line 1 of that file is just the <?php

    what the hell?
  • Zer
    New Member
    • May 2008
    • 12

    #2
    just redid my config and uploaded and it fixed the problem
    i have no idea what the hell but
    both files looked exactly alike
    and the replace fixed it. meh?

    Comment

    • Andy Huang
      Senior Member
      • Feb 2004
      • 4602

      #3
      I am suspecting that you may have edited the config.php file at one point with a text editor which added UTF-8 BOM to the beginning of the document, or added a blank new line at end of the document after ?>, which caused php to output either of them when the file was included, so it couldn't set any cookies.
      Best Regards,
      Andy Huang

      Comment

      • dvsDave
        Member
        • Nov 2005
        • 46
        • 4.0.x

        #4
        Originally posted by Andy Huang
        I am suspecting that you may have edited the config.php file at one point with a text editor which added UTF-8 BOM to the beginning of the document, or added a blank new line at end of the document after ?>, which caused php to output either of them when the file was included, so it couldn't set any cookies.
        I'm getting the same message and under the same conditions. (file works when user is logged in, and does not work when the user is logged out)

        I uploaded a clean copy of the affected files to see if that was the issue. does not appear to work.

        affected file is: http://www.controlbooth.com/forums/a...esh_navbar.php

        Comment

        • rossco_2005
          Senior Member
          • Apr 2005
          • 465
          • 4.1.x

          #5
          Originally posted by dvsDave
          I'm getting the same message and under the same conditions. (file works when user is logged in, and does not work when the user is logged out)

          I uploaded a clean copy of the affected files to see if that was the issue. does not appear to work.

          affected file is: http://www.controlbooth.com/forums/a...esh_navbar.php
          That's not a vbulletin file, it's a modification.
          Ask the mod author for a solution.

          You can look inside the file yourself to find if there are any print_r, echo, etc. functions and check for anything before the <?php and after the ?>

          http://filesharingtalk.com

          Comment

          • dvsDave
            Member
            • Nov 2005
            • 46
            • 4.0.x

            #6
            There is an echo function inside the <?php ?> tags and there is a script tag before the <?php tag.

            PHP Code:
            <script language="javascript">
               window.setInterval("ReloadFrame();", 5000);
               
               function ReloadFrame() {
                  document.frames["MyFrame1"].location.reload();
               }
            </script>
            <?php

            // ####################### SET PHP ENVIRONMENT ###########################
            error_reporting(E_ALL & ~E_NOTICE);

            // #################### DEFINE IMPORTANT CONSTANTS #######################
            define('NO_REGISTER_GLOBALS'1);
            define('THIS_SCRIPT''ad_navbarBelow'); // change this depending on your filename

            // ################### PRE-CACHE TEMPLATES AND DATA ######################
            // get special phrase groups
            $phrasegroups = array(

            );

            // get special data templates from the datastore
            $specialtemplates = array(
                
            );

            // pre-cache templates used by all actions
            $globaltemplates = array(
                
            'ad_navbarBelow',
            tarik
            );
             
            // pre-cache templates used by specific actions
            $actiontemplates = array(

            );

            // ######################### REQUIRE BACK-END ############################
            include_once('./global.php');

            // #######################################################################
            // ######################## START MAIN SCRIPT ############################
            // #######################################################################
            {
            echo <<<EOF
            <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
            <html>
            <head>
            <title>
            {$ibforums->lang['popuptitle']}{$game['gname']}</title>
            <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
            <meta http-equiv="refresh" content="30" >
            <style type="text/css" media="all"> 
            <!-- 
            body { 
               margin-left: 0px; 
               margin-top: 0px; 
               margin-right: 0px; 
               margin-bottom: 0px; 

            object, embed {
                width: 100%;
                height: 100%;
            }
            --> 
            </style>
            </head>
            <center>
            $navbar_code
            </center>
            EOF;
            exit();
            }
            $navbits = array();
            $navbits[$parent] = 'ad_navbarBelow Page';

            $navbits construct_navbits($navbits);
            eval(
            '$navbar = "' fetch_template('navbar') . '";');
            eval(
            'print_output("' fetch_template('ad_navbarBelow') . '");');
            $navbar_code

            ?>
            Last edited by dvsDave; Sat 9 Jan '10, 4:41pm.

            Comment

            widgetinstance 262 (Related Topics) skipped due to lack of content & hide_module_if_empty option.
            Working...