| Autor | Zpráva | ||
|---|---|---|---|
| Luc Profil * |
#1 · Zasláno: 7. 12. 2010, 01:06:30
Zdravím =) Mám php kod (našla jsem ho na internetu, v php plavu, nesestavila bych ho sama) který počítá přístupy na stránku. Nevíte někdo jak to udělat aby to počítalo do stovky a pak to už nepočítalo?
<?php
$soubor = "pocet.txt";
if( File_Exists($soubor) ){
print "";
}else{
$file = fopen($soubor, "a");
fputs($file, "0");
fclose($file);
}
$file = fopen($soubor, "r+");
$pocet = fgets($file, 100);
$pocet++;
fseek($file, 0);
fputs($file, $pocet);
fclose($file);
echo $pocet;
?>Předem díky za odpověď =) |
||
| johnl Profil |
#2 · Zasláno: 7. 12. 2010, 06:42:30 · Upravil/a: johnl
<?php
$soubor = "pocet.txt";
if( File_Exists($soubor) ){
print "";
}else{
$file = fopen($soubor, "a");
fputs($file, "0");
fclose($file);
}
$file = fopen($soubor, "r+");
$pocet = fgets($file, 100);
$pocet++;
if($pocet<=100){
fseek($file, 0);
fputs($file, $pocet);
fclose($file);
}
echo $pocet;
?><?php
if(file_exists("pocet.txt")){
$pocet = file_get_contents("pocet.txt");
if($pocet<=100){
file_put_contents("pocet.txt", $pocet+1);
}
echo $pocet+1;
?> |
||
| Luc Profil * |
#3 · Zasláno: 7. 12. 2010, 14:59:53
je super děkuji moc =)
|
||
|
Časová prodleva: 15 let
|
|||
0