Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

> [DIY][PHP]Poprawa skryptu statystyk
Tomy
post
Post #1





Grupa: Zarejestrowani
Postów: 5
Pomógł: 0
Dołączył: 2.05.2011

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


Mam taki se skrypcik,jednak wyskakuje mi błąd składni: Parse error: syntax error, unexpected '&', expecting

Oto mój kod:

  1. <html>
  2. <head>
  3. <?php
  4.  
  5. // - chmod this document to 755! -
  6.  
  7. $fpt = "daily.txt"; // path to counter log file - chmod it to 666
  8.  
  9. // optional configuration settings
  10.  
  11. $lock_ip =0; // IP locking and logging 1=yes 0=no
  12. $ip_lock_timeout =30; // in minutes
  13. $fpt_ip = "ip.txt"; // IP log file - chmod it to 666
  14.  
  15. // end configuration
  16.  
  17. function checkIP($rem_addr) {
  18. global $fpt_ip,$ip_lock_timeout;
  19. $ip_array = @file($fpt_ip);
  20. $reload_dat = fopen($fpt_ip,"w");
  21. $this_time = time();
  22. for ($i=0; $i<sizeof($ip_array); $i++) {
  23. list($time_stamp,$ip_addr,$hostname) = split("\|",$ip_array[$i]);
  24. if ($this_time < ($time_stamp+60*$ip_lock_timeout)) {
  25. if ($ip_addr == $rem_addr) {
  26. $found=1;
  27. }
  28. else {
  29. fwrite($reload_dat,"$time_stamp|$ip_addr|$hostname");
  30. }
  31. }
  32. }
  33. $host = gethostbyaddr($rem_addr);
  34. if (!$host) { $host = $rem_addr; }
  35. fwrite($reload_dat,"$this_time|$rem_addr|$host\n");
  36. fclose($reload_dat);
  37. return ($found==1) ? 1 : 0;
  38. }
  39.  
  40. $this_day=(date("D, j F Y"));
  41. if (!file_exists($fpt)) {
  42. $count_dat = fopen($fpt,"w+");
  43. $count = 1;
  44. fwrite($count_dat,$count);
  45. fclose($count_dat);
  46. }
  47. else {
  48. $row = file($fpt);
  49. $test = chop($row[0]);
  50. $count = $row[1];
  51. if ($this_day == $test) {
  52. if ($lock_ip==0 || ($lock_ip==1 && checkIP($REMOTE_ADDR)==0)) {
  53. $count++;
  54. }
  55. }
  56. else {
  57. $count = 1;
  58. }
  59. $count_dat = fopen($fpt,"w+");
  60. fwrite($count_dat,"$this_day\n");
  61. fwrite($count_dat,$count);
  62. fclose($count_dat);
  63. }
  64. echo "<center>Odwiedzin dzisiaj: <font color=green>$count</font></center>";
  65.  
  66. ?>
  67.  
  68.  
  69. </font>
  70. </html>


Uruchamiam go kodem:
  1. {include file="engine/modules/dcounter.php"}


Dzięki wielkie za pomocną dłoń ;-)
Powód edycji: [Daiquiri]: Tag
Go to the top of the page
+Quote Post

Posty w temacie


Closed 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 - 20:18