www.webdeveloper.com
Results 1 to 5 of 5

Thread: Warning: Cannot modify header information - headers already sent by error code review

  1. #1
    Join Date
    Dec 2009
    Posts
    22

    Exclamation Warning: Cannot modify header information - headers already sent by error code review

    Ok iv found alot of things on google about this and iv done what theyv suggested but still no luck.... so the only thing iv thought to do is to post the code here and see if anyone can see where the problem is coming from.

    This is my common.php file which is the file causing the error.

    PHP Code:
    <?php  //common.php :: Contain common functions
    ob_start(); 
    /*
        OGame v0.01
    martinm93@interia.pl
    */
    //header("Powered-By: azrail");
    define('VERSION','8.1a');
    error_reporting  (E_ERROR E_WARNING E_PARSE); // Para evitar que se reporten las variables no iniciadas

    extract($_POST,EXTR_SKIP);
    extract($_GET,EXTR_SKIP);
    extract($_COOKIE,EXTR_SKIP);
    //
    // Definimos algunas arrays de configuracion.
    //
    $game_config = array();
    $user = array();
    $theme = array();
    $images = array();
    $lang = array();
    //
    // Constantes
    //
    //http://80.237.203.201/download/use/reloaded/
    //http://people.freenet.de/kakashi/Maya/blueplanet
    define('DEFAULT_SKINPATH',"http://80.237.203.201/download/use/g3cko/");
    define('TEMPLATE_DIR',"templates/");
    define('TEMPLATE_NAME',"OpenGame");
    //
    //lenguaje...
    //
    if (isset($_SERVER['HTTP_ACCEPT_LANGUAGE'])){
        
    $HTTP_ACCEPT_LANGUAGE substr($_SERVER['HTTP_ACCEPT_LANGUAGE'],0,2);
    }else{
        
    $HTTP_ACCEPT_LANGUAGE "en";
    }
    //default language}
    if(is_dir($ugamela_root_path."language/".$HTTP_ACCEPT_LANGUAGE.'/')){
        
    define('DEFAULT_LANG',$HTTP_ACCEPT_LANGUAGE);
    }else{
        
    define('DEFAULT_LANG','en');
    }
    //include($ugamela_root_path . 'config.'.$phpEx);
    // no muy necesario ...
    //if( !defined("UGAMELA_INSTALLED") )
    //{
    //    header('Location: ' . $ugamela_root_path . 'install/install.' . $phpEx);
    //    exit;
    //}
    //--[ DEPURAR ]-------------------------------------------------------------
    //Objeto debug
    include($ugamela_root_path 'includes/debug.class.'.$phpEx);
    $debug = new debug;
    //--[ /DEPURAR ]------------------------------------------------------------
    include($ugamela_root_path 'includes/constants.'.$phpEx);
    include(
    $ugamela_root_path 'includes/functions.'.$phpEx);
    include(
    $ugamela_root_path 'includes/vars.'.$phpEx);
    include(
    $ugamela_root_path 'includes/db.'.$phpEx);
    include(
    $ugamela_root_path 'includes/planet_maker.'.$phpEx);
    include(
    $ugamela_root_path 'includes/rank_maker.'.$phpEx);
    include(
    $ugamela_root_path 'includes/strings.'.$phpEx);
    /*
      Aqui realizamos la obtencion de datos de datos del juego.
    */
    $query doquery("SELECT * FROM {{table}}",'config');
    while ( 
    $row mysql_fetch_assoc($query) )
    {
        
    $game_config[$row['config_name']] = $row['config_value'];
    }
    include(
    $ugamela_root_path."language/".DEFAULT_LANG."/lang_info.cfg");
    //
    // Muestra un mensaje de Servidor cerrado.
    //
    if( $game_config['game_disable'] && !defined("IN_ADMIN") && !defined("IN_LOGIN") )
    {
        
    //message('El juego ha sido cerrado, Intenta volver en otro momento.', 'Juego cerrado');
    }
    // Created by Perberos. All rights reversed (C) 2006
    ob_end_flush();
    ?>
    Thx hope i can find out why this is still happening.

  2. #2
    Join Date
    Nov 2008
    Posts
    2,477
    I don't see anywhere you are setting a header in this file? Do you do it in one of the includes? Anyway the issue will be that there is some kind out output being sent to the browser before you send a header. I can't see anything in the code you posted, but some things to check are:

    Make sure there are no spaces before <?php or after ?> in this file, and any included fles.
    Make sure none of the included files echo or print etc any content.

    I would also ditch the output buffering as this will confuse things when trying to find the problem.

  3. #3
    Join Date
    Dec 2009
    Posts
    22
    Yea...... i forgot to mention that my project worked when i ran it on my own server. Like i had it running fine without the error on my computer but i recently bought a domain and ftpd the files to it and now it doesnt work. I have sql set up the same way and everything.... Any other ideas as to why and how that would happen?

  4. #4
    Join Date
    Aug 2004
    Location
    Ankh-Morpork
    Posts
    18,912
    Usually the error message tells you what line in what file generated output. If it tells you it's line 1 of your script, it may be that your editor saved the file as UTF8 with a byte order mark (BOM) at the beginning. You may need to edit it and save it, making sure to specify to either save it as plain ASCII text or else UTF8 with no BOM. Otherwise, make sure there is nothing (not even a newline or space) before the opening <?php.
    "Please give us a simple answer, so that we don't have to think, because if we think, we might find answers that don't fit the way we want the world to be."
    ~ Terry Pratchett in Nation

    eBookworm.us

  5. #5
    Join Date
    Dec 2009
    Posts
    22
    Ok i just found out that my ftper was uploading the files from my old site as binaries i deleted everything and im reuploading it to see if that fixes it

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center



Recent Articles