Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

> [PHP] Licznik online
Winger
post
Post #1





Grupa: Zarejestrowani
Postów: 3
Pomógł: 0
Dołączył: 17.11.2008

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


  1. <?php
  2. if (!$datei) $datei = dirname(__FILE__)."/$filename";
  3. $time = @time();
  4. $ip = $REMOTE_ADDR;
  5. $string = "$ip|$time\n";
  6. $a = fopen("$filename", "a+");
  7. fputs($a, $string);
  8. fclose($a);
  9.  
  10. $timeout = time()-(60*$timer);
  11.  
  12. $all = "";
  13. $i = 0;
  14. $datei = file($filename);
  15. for ($num = 0; $num < count($datei); $num++) {
  16.    $pieces = explode("|",$datei[$num]);
  17.  
  18.        if ($pieces[1] > $timeout) {
  19.            $all .= $pieces[0];
  20.            $all .= ",";
  21.        }
  22.    $i++;
  23. }
  24.  
  25. $all = substr($all,0,strlen($all)-1);
  26. $arraypieces = explode(",",$all);
  27. $useronline = count(array_flip(array_flip($arraypieces)));
  28.  
  29.  
  30. echo $useronline;
  31.  
  32.  
  33. $dell = "";
  34. for ($numm = 0; $numm < count($datei); $numm++) {
  35.    $tiles = explode("|",$datei[$numm]);
  36.        if ($tiles[1] > $timeout) {
  37.            $dell .= "$tiles[0]|$tiles[1]";
  38.        }
  39. }
  40.  
  41. if (!$datei) $datei = dirname(__FILE__)."/$filename";
  42. $time = @time();
  43. $ip = $REMOTE_ADDR;
  44. $string = "$dell";
  45. $a = fopen("$filename", "w+");
  46. fputs($a, $string);
  47. fclose($a);
  48. ?>


Taki mam licznik online i cały czas pokazuje, że na stronie jest 1 osoba... to mam zapisane w pliku online.php i includuje sobie to w odpowiednim bloku...wiecie może jak to ugryźć? z góry dziękuje za pomoc...

Ten post edytował Winger 26.11.2008, 12:57:45
Powód edycji: Dodałem tag. /webdice
Go to the top of the page
+Quote Post

Posty w temacie


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

 



RSS Aktualny czas: 26.09.2025 - 09:00