Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

> licznik ale cookies nie dzilają
uroczy
post
Post #1





Grupa: Zarejestrowani
Postów: 90
Pomógł: 0
Dołączył: 3.02.2006
Skąd: Łódź

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


  1. <?php
  2. $COUNT_FILE = "plik.txt";
  3. // En: Absolute path and name to count data file.
  4. // Fr: Chemin absolu (complet) et Nom du fichier compteur.
  5.  
  6. $IMG_DIR_URL = "./digits/";
  7. // En: URL Directory of digits (0.gif ... 9.gif).
  8. // Fr: URL du repertoire des images (0.gif ... 9.gif).
  9.  
  10. $NB_DIGITS = 5;
  11. // En: Minimum number of digits to display (0, to not use 0 left).
  12. // Fr: Nombre minimum de chiffre ŕ afficher (0 pour ne pas avoir de 0 devant).
  13.  
  14. $EXPIRE_DATE = 1800;
  15. // En: Cookies Expiration date (second).
  16. // Fr: Date d'expiration du cookies (en seconde);
  17.  
  18. // End Necessary Variables section
  19. /******************************************************************************/
  20.  
  21. if (file_exists($COUNT_FILE)) {
  22. // En: Open, read, increment, save and close file.
  23. // Fr: Ouvre, lit, incrémente, sauve et ferme le fichier.
  24. $fp = fopen("$COUNT_FILE", "r+");
  25. flock($fp, 1);
  26. $count = fgets($fp, 4096);
  27. if ($visited == "") {
  28. $count += 1;
  29. setcookie("visited", $count, time()+$EXPIRE_DATE , "/", $SERVER_NAME);
  30. fseek($fp,0);
  31. fputs($fp, $count);
  32. }
  33. flock($fp, 3);
  34. fclose($fp);
  35. } else {
  36. // En: Display a error message if file does not exist.
  37. // Fr: Affiche un message d'erreur si le fichier n'existe pas.
  38. echo "Can't find file, check '\$file' var...<BR>";
  39. }
  40.  
  41. // En: Display count value
  42. // Fr: Affiche le nombre de visiteur.
  43.  
  44. chop($count);
  45. $nb_digits = max(strlen($count), $NB_DIGITS);
  46. $count = substr("0000000000".$count, -$nb_digits);
  47.  
  48. $digits = preg_split("//", $count);
  49.  
  50. for($i = 0; $i <= $nb_digits; $i++) {
  51. if ($digits[$i] != "") {
  52. $html_result .= "<IMG SRC=\"$IMG_DIR_URL$digits[$i].gif\">";
  53. }
  54. }
  55. ?>
witajcie sciągnołem taki licznik smile.gif wszystko ładnie by działało ale tylko na serwerze w domu gdy wysyałm na serwer zenętrzy cokkies nie działają winksmiley.jpg i kążde odświerzenie strony konczy sie przeładowaniem licznika czy ktoś wie jak to naprawić tak jak by ich nie czytał /

http://6ldsh.zhpwidzew.pl/ <- mozna sprawdzić jestem w kropce !?
____
zmianya nazwy cistezka nie dała rezultatu :/

Ten post edytował uroczy 19.02.2006, 21:32:25


--------------------
.::::. |::::|
Go to the top of the page
+Quote Post

Posty w temacie


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 Aktualny czas: 21.08.2025 - 18:23