Jump to content
php.lv forumi

Kliku skaitītājs


Wo[ix]lf

Recommended Posts

kaukā šitā

<?php 
$file='counter.txt';
fclose(fopen($file,'a+b'));
$f=fopen($file,'r+t');   
flock($f,LOCK_EX);         
$count=fread($f,100);   
$count=$count+1;         
ftruncate($f,0);           
fseek($f,0,SEEK_SET);     
fwrite($f,$count);          
fclose($f);                
echo $count;             
?>

Link to comment
Share on other sites

es buutu taisiijistaa, ka katru reizi noklikshkjinot skripts pieksiata mainigajam viens, kuru peec tam saglabaa sesijaa. iznjeemumgadiijumos, kas submito formas vai etc viens netiek pieskaitiits (to ar get parametru noraada).

Link to comment
Share on other sites

es buutu taisiijistaa, ka katru reizi noklikshkjinot skripts pieksiata mainigajam viens, kuru peec tam saglabaa sesijaa. iznjeemumgadiijumos, kas submito formas vai etc viens netiek pieskaitiits (to ar get parametru noraada).

15104[/snapback]

 

 

kliks (hits) - 1 refreshs

hosts - 1 sessija apmeklējums

uniq hosts - unikāls hosts pa periodu

 

$cnt = @ (int) file_get_contents( 'counter.txt' ) + 1;
fwrite( fopen('counter.txt','w'), $cnt );

Link to comment
Share on other sites

kliks (hits) - 1 refreshs

hosts - 1 sessija apmeklējums

uniq hosts - unikāls hosts pa periodu

 

$cnt = @ (int) file_get_contents( 'counter.txt' ) + 1;
fwrite( fopen('counter.txt','w'), $cnt );

15108[/snapback]

nav jau teikts, cik ilgaa periodaa tos klikus vajag skaitiit...

labāk izmantot log failus, lai apskatītos statistiku.

Link to comment
Share on other sites

nav jau teikts, cik ilgaa periodaa tos klikus vajag skaitiit...

labāk izmantot log failus, lai apskatītos statistiku.

15112[/snapback]

 

nu a ja userim nav pieejami log-faili ?

 

$fileName = sprintf( 'counter_%s.txt'", date('Ymd') );

Link to comment
Share on other sites

×
×
  • Create New...