Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

> [PHP]Licznik
Skr3czu
post
Post #1





Grupa: Zarejestrowani
Postów: 215
Pomógł: 0
Dołączył: 12.03.2007

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


Witam

Mam taki licznik:

licznik.php
  1. <?php
  2.  
  3. $countfile = "data.txt";
  4. $visible = TRUE;
  5.  
  6. $arr = getdate();
  7. $since = $arr["mday"].$arr["mon"].$arr["year"];
  8.  
  9. if ($QUERY_STRING != ""){$url = $PHP_SELF.'?'.$QUERY_STRING;}
  10. else{$url = $PHP_SELF;}
  11. $written = FALSE;
  12.  
  13. if (file_exists($countfile))
  14. {
  15.  $temparray = file($countfile);
  16.  for($index = 0; $index < count($temparray); $index++)
  17.  {
  18. $entry = explode("|",$temparray[$index]);
  19. if(!strcmp($entry[4],$url))
  20. {
  21.  if($entry[2] != $since){$entry[1]=0;}
  22.  if($entry[3] != $REMOTE_ADDR){$entry[0]++; $entry[1]++;}
  23.  $entry[2] = $since;
  24.  $entry[3] = $REMOTE_ADDR;
  25.  $tempentry = $entry;
  26.  $temparray[$index] = implode($entry,"|");
  27.  $fp = fopen($countfile,"w");
  28.  for($index = 0; $index < count($temparray); $index++){
  29.  fputs($fp,$temparray[$index]);}
  30.  fclose($fp);
  31.  if($visible == TRUE) {print("$tempentry[0] Ogólnie <br> $tempentry[1] Dzisiaj");}
  32.  $written = TRUE;
  33. }
  34.  }
  35. }
  36. if($written == FALSE)
  37. {
  38.  $entry = "1|1|$since|$REMOTE_ADDR|$url|\n";
  39.  $fp = fopen($countfile,"a");
  40.  fputs($fp,$entry,256);
  41.  fclose($fp);
  42.  if($visible == TRUE) {print("Odśwież");}
  43. }
  44. ?>


I demo:
http://crims.ggopisy.org/licz/licznik.php

I mam takie coś:
1 Ogólnie
1 Dzisiaj

I co trzeba zmienić, aby było wyświetlane ile wczoraj było osób ?

np.
1 Ogólnie
1 Dzisiaj
1 Wczoraj

Pozdrawiam

Ten post edytował Skr3czu 20.08.2007, 19:23:09
Go to the top of the page
+Quote Post

Posty w temacie
- Skr3czu   [PHP]Licznik   20.08.2007, 19:22:12
- - -kazik-   Witam Szukam w necie i trafiłem na Waszą stronę,...   30.09.2007, 17:32:27


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: 19.08.2025 - 21:02