1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

DMR Code error

Discussion in 'PHP & Perl' started by S1lv3rdo7, Apr 29, 2013.

  1. S1lv3rdo7

    S1lv3rdo7 Regular Member

    Joined:
    Jul 17, 2010
    Messages:
    480
    Likes Received:
    315
    Occupation:
    Tech Support
    Location:
    Austin, TX
    I used the DMR script from this thread.

    http://www.blackhatworld.com/blackh...0996-blank-referer-v2-0-meta-refresh-dmr.html

    These two files are located in a directory with WordPress installed on it. I don't know if that has anything to do with it. I changed the files names to tracking and tracking 2. Here is the page code and the error.

    PHP Error

    Code:
    [B]Warning[/B]:  Cannot modify header information - headers already sent  by (output started at  /home/silverdo/public_html/thepickupartistblog.com/tracking.php:1) in [B]/home/silverdo/public_html/thepickupartistblog.com/tracking.php[/B] on line [B]9[/B]
    Tracking.php
    Code:
     <?php
    
        $referer = $_SERVER['HTTP_REFERER'];
    
        if($referer == "")
        
    {
    
    header("Location: http://www.mb01.com/lnk.asp?o=4990&c=57066&a=51894");
    
    }else{
    
    echo "<meta http-equiv=\"refresh\"content=\"0;url=http://thepickupartistblog.com/tracking2.php\">";
    
    }
    ?> 
    
    Tracking2.php

    Code:
     <?php
    
        $referer = $_SERVER['HTTP_REFERER'];
    
        if($referer == "")
        
    {
    
    header("Location: http://www.mb01.com/lnk.asp?o=4990&c=57066&a=51894");
    
    }else{
    
    echo "<meta http-equiv=\"refresh\"content=\"0;url=http://google.com\">";
    
    }
    ?> 
    I don't know what's causing the header problem. Any help is appreciated!
     
  2. healzer

    healzer Jr. Executive VIP Jr. VIP Premium Member

    Joined:
    Jun 26, 2011
    Messages:
    2,363
    Likes Received:
    1,966
    Gender:
    Male
    Occupation:
    Marketing automation tools
    Location:
    Somewhere in Europe
    Home Page:
    I have this problem a lot, just by looking into the error code :)

    I never quite remember how I fixed those always, but I do remember one thing:

    http://www.daniweb.com/web-developm...odify-header-information.headers-already-sent

    search in google for:
    php ob_start "headers already sent"


    I'm not sure if this is correct, but for all my php scripts I include ob_start() at the very top, and ob_end_flush() at the very bottom.

    <?php
    ob_start();
    ....
    blablablabal
    blablablabal
    ...
    ob_end_flush();
    ?>
     
    • Thanks Thanks x 1
  3. S1lv3rdo7

    S1lv3rdo7 Regular Member

    Joined:
    Jul 17, 2010
    Messages:
    480
    Likes Received:
    315
    Occupation:
    Tech Support
    Location:
    Austin, TX
    Healzer your the man! Rep added!

    Added

    <?php
    ob_start();
    ....
    blablablabal
    blablablabal
    ...
    ob_end_flush();
    ?>

    and changed

    header("Location: http://www.mb01.com/lnk.asp?o=4990&c=57066&a=51894");

    gets changed to

    echo "<meta http-equiv=\"refresh\"content=\"0;url=http://www.mb01.com/lnk.asp?o=4990&c=57066&a=51894\">";

    worked like a charm. I'll update the other thread in case someone else has this problem.
     
    • Thanks Thanks x 1