SitePoint Sponsor

User Tag List

Results 1 to 4 of 4
  1. #1
    SitePoint Guru
    Join Date
    Mar 2006
    Posts
    701
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Cannot modify header information problem

    I have the 'Cannot modify header information problem' at my lohin page.
    I make for test purpose a page
    Code:
    <?php require_once('header1.php');?>
    <?php if (@$_GET['app'] != null) { ?>
    <?php $app=$_GET['app'].".php"; ?>
    <?php include($app);?><?php } 
    else {?><?php include("home_page.php"); ?><?php } ?>  ?>
    when the header1.php is empty all is ok but when I write a single word there is the Cannot modify header warning.
    What is wrong? I use the php login functions of dreamweather toolbox

  2. #2
    Web Professional
    Join Date
    Oct 2008
    Location
    London
    Posts
    862
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    HTTP headers must to be sent before any content. You're sending some headers (most likely a cookie from session_start()) after you've sent content.

    Plus, what you're doing is very insecure. You're including a file from a variable ($_GET['app']) you don't have control over. You need to use a whitelist or some sort of valildation.

  3. #3
    From Italy with love silver trophybronze trophy
    guido2004's Avatar
    Join Date
    Sep 2004
    Posts
    9,510
    Mentioned
    163 Post(s)
    Tagged
    4 Thread(s)
    There probably is an empty line, or a space outside of the php open and close tags. If it happens only when header1.php has content, then this problem probably occurs in that file. Or you echo something in the header1.php file.

    Can you post the content of header1.php?
    And can you also post the code that triggers the error?

  4. #4
    dooby dooby doo silver trophybronze trophy
    spikeZ's Avatar
    Join Date
    Aug 2004
    Location
    Manchester UK
    Posts
    13,807
    Mentioned
    158 Post(s)
    Tagged
    3 Thread(s)
    The error message give you the exact location of the problem and a description.
    Post it up as Guido said if you cant figure it
    Mike Swiffin - Community Team Advisor
    Only a woman can read between the lines of a one word answer.....


Bookmarks

Posting Permissions

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