Register

If this is your first visit, please click the Sign Up now button to begin the process of creating your account so you can begin posting on our forums! The Sign Up process will only take up about a minute of two of your time.

Results 1 to 5 of 5
  1. #1
    Member Arkantos's Avatar
    Join Date
    Jul 2005
    Posts
    66
    Member #
    10732
    hello all,

    this is the code, i am only posting the relevant snippet:

    PHP Code:
     <?PHP                                         ---line 25
     $file 
    "counter.txt";
     
    $open fopen($file"r");
     
    $size filesize($file);
     
    $count fread($open$size);
     
    fclose($open);
     if (!isset(
    $_COOKIE['orientcount'])) {
        
    $open fopen($file"w");
        
    $count++;
        
    fwrite($open$count);
        
    fclose($open);
        
    setcookie("orientcount","counted_once",time()+66600000);     ----line 36
        
    }
     
    ?>
    the error:

    Code:
    Warning: Cannot modify header information - headers already sent by (output started at /home/oriental/public_html/index.php:9) in /home/oriental/public_html/index.php on line 36
    what am i doing wrong??

    this code is working quite correctly in localhost, but the moment it is going to the remote server, this is the error message i am getting.

    you can see it here:
    www.orientalarchive.com/index.php

    also, in the error message, there is a 9:
    ....../index.php:9)

    what does this 9 stand for??

    please help.
    thank you,

    waiting for your replies,

    Arkantos.
    No bastard ever won a war by dying for his country, he won it by making the other poor dumb bastard dying for his country.
    General George S. Patton (US Army)

  2.  

  3. #2
    Member tlcook's Avatar
    Join Date
    Nov 2006
    Posts
    38
    Member #
    14386
    It means you're outputting HTML at line 9 of your index.php file.

    Remove line 9 if possible, and see if you still get the error.

  4. #3
    Senior Member Ferro's Avatar
    Join Date
    Oct 2006
    Location
    UK
    Posts
    386
    Member #
    14204
    Liked
    5 times
    Nice avatar, arkantos :ninja:

  5. #4
    Senior Member
    Join Date
    Jun 2005
    Location
    Atlanta, GA
    Posts
    4,146
    Member #
    10263
    Liked
    1 times
    Yeah, you probably left a blank newline or something. Cookies are sent with the HTTP headers, which means they are sent before any actual HTML goes out. If HTML goes out, you can't send cookies, unless you use buffering, which is weird but not particularly difficult, as I remember it.

  6. #5
    Member Arkantos's Avatar
    Join Date
    Jul 2005
    Posts
    66
    Member #
    10732
    thank you for your replies.

    line 9 was the beginning of a javascript routine.

    finally i figured it out.

    i put the counter code before the <HTML> tag, and voila!
    everything was working perfectly.

    thank you everyone.

    regards,
    Ark!
    No bastard ever won a war by dying for his country, he won it by making the other poor dumb bastard dying for his country.
    General George S. Patton (US Army)


Remove Ads

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
All times are GMT -6. The time now is 03:04 AM.
Powered by vBulletin® Version 4.2.3
Copyright © 2019 vBulletin Solutions, Inc. All rights reserved.
vBulletin Skin By: PurevB.com