Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

 
Closed TopicStart new topic
> [DIY][PHP]Warning 17,  Warning: Cannot modify header information - headers already s
NorQ
post
Post #1





Grupa: Zarejestrowani
Postów: 91
Pomógł: 0
Dołączył: 15.07.2011

Ostrzeżenie: (0%)
-----


Witam, mam ostatnio pewien problem z licznikiem odwiedzin w PHP do którego użyłem grafikę z free4u.pl!
O to błąd:
Kod

Warning: Cannot modify header information - headers already sent by (output started at /home/radioult/public_html/index.php:1) in /home/radioult/public_html/scripts/count.php on line 17



SKRYPT:

Kod
<?php

$COUNT_FILE = "scripts/count_data.txt";

$IMG_DIR_URL = "../images/";

$NB_DIGITS = 8;

$EXPIRE_DATE = 86400;

if (file_exists($COUNT_FILE)) {
    $fp = fopen("$COUNT_FILE", "r+");
    flock($fp, 1);
    $count = fgets($fp, 4096);
    if ($visited == "") {
        $count += 1;
        setcookie("visited", $count, time()+$EXPIRE_DATE , "/", $SERVER_NAME);
        fseek($fp,0);
        fputs($fp, $count);
    }
    flock($fp, 3);
    fclose($fp);
} else {
    echo "Nieudało się wczytać pliku zapisu!";
    exit;
}

chop($count);
$nb_digits = max(strlen($count), $NB_DIGITS);
$count = substr("0000000000".$count, -$nb_digits);

$digits = preg_split("//", $count);

for($i = 0; $i <= $nb_digits; $i++) {
    if ($digits[$i] != "") {
        $html_result .=  "<IMG SRC=\"$IMG_DIR_URL$digits[$i].gif\">";
    }
}

?>
Go to the top of the page
+Quote Post
wookieb
post
Post #2





Grupa: Moderatorzy
Postów: 8 989
Pomógł: 1550
Dołączył: 8.08.2008
Skąd: Słupsk/Gdańsk




Temat omawiamy setki tysiące razy. Poszukaj na forum. Zamykam.
Go to the top of the page
+Quote Post

Closed TopicStart new topic
2 Użytkowników czyta ten temat (2 Gości i 0 Anonimowych użytkowników)
0 Zarejestrowanych:

 



RSS Aktualny czas: 23.08.2025 - 06:49