0

Possible Duplicate:
Headers already sent by PHP

I got headers alreayd sent errors on my wordpress theme's home page. My functions like ;

function LoopCokiee() {
    if(isset($_COOKIE['PozCounter'])) 
    { 

         setcookie("PozCounter", ++$_COOKIE['PozCounter'], time()+3600); 
    } 
    else 
    { 

         setcookie("PozCounter", 1, time()+3600); 
    } 

    return $_COOKIE['PozCounter'];

}

function LoopCokieeUpdate () {
    $Kuki = $_COOKIE['PozCounter'];
    $Topl = '20'; //wp_count_posts()->publish;

    if ($Kuki > $Topl ) {
        setcookie("PozCounter", 1, time()+3600); 
    } else {
        return $_COOKIE['PozCounter'];
    }

}

This functions wordks perfectly on my local but i didint understand whats wrong with hostgator ?

When i called my functions;

<?php 
 LoopCokiee();
 LoopCokieeUpdate();
echo '<!--LoopResults--'.LoopCokiee().'//'.LoopCokieeUpdate().'-->'
?>

This errors apper ;

Warning: Cannot modify header information - headers already sent by (output started at /home/igze/public_html/ddddd.com/wp-content/themes/smooth/home.php:1) in /home/igze/public_html/ddddd.com/wp-content/themes/smooth/PozHook/index.php on line 11

Warning: Cannot modify header information - headers already sent by (output started at /home/igze/public_html/ddddd.com/wp-content/themes/smooth/home.php:1) in /home/igze/public_html/ddddd.com/wp-content/themes/smooth/PozHook/index.php on line 11

What should i do ? Any helps thanks.

Community
  • 1
  • 1
Fatih Toprak
  • 1,097
  • 1
  • 19
  • 48

2 Answers2

1

before sending headers do not use any output

MaXyC
  • 27
  • 5
1

You cannot set a cookie after data has already been sent to the web browser to output. You must set cookies before this happens or use output buffering.

EM-Creations
  • 4,195
  • 4
  • 40
  • 56