Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

> [php] Jak zamieścić licznik php na stronie o rozszerzeniu .html ?
Badi
post
Post #1





Grupa: Zarejestrowani
Postów: 6
Pomógł: 0
Dołączył: 18.03.2007

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


Jak w temacie...... mam skrypt php :


  1. <?php
  2. // En: Begin PHP Code / Fr: Debut code PHP
  3. /******************************************************************************
  4. * Cookies digits Access Counter Version 1.0  *
  5. * Copyright 2000 Frederic TYNDIUK (FTLS)  All Rights Reserved. *
  6. * E-Mail: tyndiuk@ftls.org  Script License: GPL  *
  7. * Created 02/28/2000 Last Modified 02/28/2000 *
  8. * Scripts Archive at: <a href="http://www.ftls.org/php/" target="_blank">http://www.ftls.org/php/</a> *
  9. *******************************************************************************/
  10. // Necessary Variables:
  11.  
  12. $COUNT_FILE = "count_data.txt";
  13. // En: Absolute path and name to count data file.
  14. // Fr: Chemin absolu (complet) et Nom du fichier compteur.
  15.  
  16. $IMG_DIR_URL = "./digits/";
  17. // En: URL Directory of digits (0.gif ... 9.gif).
  18. // Fr: URL du repertoire des images (0.gif ... 9.gif).
  19.  
  20. $NB_DIGITS = 0;
  21. // En: Minimum number of digits to display (0, to not use 0 left).
  22. // Fr: Nombre minimum de chiffre ŕ afficher (0 pour ne pas avoir de 0 devant).
  23.  
  24. $EXPIRE_DATE = 1;
  25. // En: Cookies Expiration date (second).
  26. // Fr: Date d'expiration du cookies (en seconde);
  27.  
  28. // End Necessary Variables section
  29. /******************************************************************************/
  30.  
  31. if (file_exists($COUNT_FILE)) {
  32. // En: Open, read, increment, save and close file.
  33. // Fr: Ouvre, lit, incrémente, sauve et ferme le fichier.
  34. $fp = fopen("$COUNT_FILE", "r+");
  35. flock($fp, 1);
  36. $count = fgets($fp, 4096);
  37. if ($visited == "") {
  38. $count += 1;
  39. setcookie("visited", $count, time()+$EXPIRE_DATE , "/", $SERVER_NAME);
  40. fseek($fp,0);
  41. fputs($fp, $count);
  42. }
  43. flock($fp, 3);
  44. fclose($fp);
  45. } else {
  46. // En: Display a error message if file does not exist.
  47. // Fr: Affiche un message d'erreur si le fichier n'existe pas.
  48. echo "Can't find file, check '$file' var...<BR>";
  49. }
  50.  
  51. // En: Display count value
  52. // Fr: Affiche le nombre de visiteur.
  53.  
  54. chop($count);
  55. $nb_digits = max(strlen($count), $NB_DIGITS);
  56. $count = substr("0000000000".$count, -$nb_digits);
  57.  
  58. $digits = preg_split("//", $count);
  59.  
  60. for($i = 0; $i <= $nb_digits; $i++) {
  61. if ($digits[$i] != "") {
  62. $html_result .= "<IMG SRC="$IMG_DIR_URL$digits[$i].gif">";
  63. }
  64. }
  65. // En: End PHP Code
  66. // Fr: Fin code PHP
  67. ?>
  68.  
  69. <HTML><HEAD><TITLE>Counter</TITLE></HEAD>
  70. <BODY BGCOLOR="white">
  71. <BR><BR><P ALIGN="Center"><FONT FACE="Arial, helvetica" SIZE="+2" COLOR="#336699"><STRONG><EM></EM></STRONG></FONT></P><BR>
  72.  
  73.  
  74.  
  75.  
  76.  
  77.  
  78. <?php echo $html_result ?>
  79.  
  80.  
  81.  
  82. <FONT FACE="Arial" SIZE=-2>
  83.  
  84. <BR></A></EM></FONT>
  85. </CENTER>
  86. </BODY></HTML>



Zamieściłem to wraz z obrazkami i plikiem count_data.txt na serwerze z php i zrobiłem plik .html z kodem
  1. <IMG SRC = adreslicznika.php>
gdzyż tak podobno sie robi żeby wyświetlić licznik graficzny. Niestety licznik nie wyświetla liczb ...... co musze zrobić questionmark.gif
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: 20.08.2025 - 14:18