Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

 
Reply to this topicStart new topic
> licznik - problem z ciasteczkiem
froth
post 2.03.2004, 17:22:18
Post #1





Grupa: Zarejestrowani
Postów: 37
Pomógł: 0
Dołączył: 24.02.2004

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


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]
Go to the top of the page
+Quote Post
seaquest
post 2.03.2004, 17:29:48
Post #2





Grupa: Przyjaciele php.pl
Postów: 790
Pomógł: 7
Dołączył: 6.02.2003
Skąd: Polska

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


setcookie musi być przed <html>
używaj bbcode :!:!


--------------------
Michał Płachta
Warsztat: Mac OS X Leopard, PostgreSQL, Text Mate, Retrospectiva + SVN
Go to the top of the page
+Quote Post
froth
post 2.03.2004, 17:31:53
Post #3





Grupa: Zarejestrowani
Postów: 37
Pomógł: 0
Dołączył: 24.02.2004

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


ehhh bylo tylko zaczalem sie bawic i troche testowac i tak przekopiowalem.Ale bylo i nie dzialalo.
Go to the top of the page
+Quote Post
seaquest
post 2.03.2004, 17:33:15
Post #4





Grupa: Przyjaciele php.pl
Postów: 790
Pomógł: 7
Dołączył: 6.02.2003
Skąd: Polska

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


to razcej niemozliwe, blad mowi, ze przed setcookie wyslales cos do przegladarki


--------------------
Michał Płachta
Warsztat: Mac OS X Leopard, PostgreSQL, Text Mate, Retrospectiva + SVN
Go to the top of the page
+Quote Post
Jabol
post 2.03.2004, 17:40:14
Post #5





Grupa: Przyjaciele php.pl
Postów: 1 467
Pomógł: 13
Dołączył: 22.02.2003

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


no więc tak. Proszę ten post wyedytować, a do tego czasu wszystkie inne posty będą usuwane!
Go to the top of the page
+Quote Post
froth
post 2.03.2004, 18:06:53
Post #6





Grupa: Zarejestrowani
Postów: 37
Pomógł: 0
Dołączył: 24.02.2004

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


juz wyedytowalem
Go to the top of the page
+Quote Post
BzikOS
post 2.03.2004, 18:18:05
Post #7





Grupa: Przyjaciele php.pl
Postów: 660
Pomógł: 0
Dołączył: 28.08.2002
Skąd: Starachowice

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


Cytat
juz wyedytowalem

A więc gdzie to BBCode?
Go to the top of the page
+Quote Post
Jabol
post 2.03.2004, 18:20:33
Post #8





Grupa: Przyjaciele php.pl
Postów: 1 467
Pomógł: 13
Dołączył: 22.02.2003

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


Cytat
juz wyedytowalem
wyedytować a nie napisać nowy post!
Go to the top of the page
+Quote Post

Reply to this topicStart new topic
1 Użytkowników czyta ten temat (1 Gości i 0 Anonimowych użytkowników)
0 Zarejestrowanych:

 



RSS Wersja Lo-Fi Aktualny czas: 29.06.2025 - 06:19