Prikazi cijelu temu 09.07.2020 12:27
zxz Van mreze
Administrator
Registrovan od:03.02.2009
Lokacija:Tuzla


Predmet:Brojac posjeta
Brojac posjeta
PreuzmiIzvorni kôd (PHP):
  1. <?php
  2.  
  3. /**
  4. * Create an empty text file called counterlog.txt and
  5. * upload to the same directory as the page you want to
  6. * count hits for.
  7. *
  8. * Add this line of code on your page:
  9. * <?php include "text_file_hit_counter.php"; ?>
  10. */
  11.  
  12. // Open the file for reading
  13. $fp = fopen("counterlog.txt", "r");
  14.  
  15. // Get the existing count
  16. $count = fread($fp, 1024);
  17.  
  18. // Close the file
  19. fclose($fp);
  20.  
  21. // Add 1 to the existing count
  22. $count = $count + 1;
  23.  
  24. // Display the number of hits
  25. // If you don't want to display it, comment out this line
  26. echo  $count . " posjeta od 17.2.2011 ";
  27.  
  28. // Reopen the file and erase the contents
  29. $fp = fopen("counterlog.txt", "w");
  30.  
  31. // Write the new count to the file
  32. fwrite($fp, $count);
  33.  
  34. // Close the file
  35. fclose($fp);
  36.  
  37. ?>

Podrška samo putem foruma, jer samo tako i ostali imaju koristi od toga.