mam liicznik:
<?php
setcookie("visited", "1", time()+3600*3);
?>
<head>
<html>
pozniej jest:
<?
if(file_exists("counter.n"))
{
$file=fopen("counter.n", "r");
flock($file, 1);
$ile=fgets($file, 100);
flock($file, 3);
fclose($file);
if($_COOKIE['visited']!="1")
{
$ile++;
}
}
else
{
$ile=1;
}
$file=fopen("counter.n", "w");
flock($file, 2);
fwrite($file, $ile);
flock($file, 3);
fclose($file);
echo($ile);
?>
a w rezulatcie wysxkakuje mi:
Warning: Cannot modify header information - headers already sent by (output started at /home/www/rox/index.php:4) in /home/www/rox/index.php on line 5
na samej gorze strony.Licznik dziala tylko nie jest orporny na odswiezanie.
?>[/php]