I have a counter on my page. It counts how many is online right now, and how many has viewed the page, and prints the week number today. But for some reason it increases the views by 2, and not one. I am totaly blind on this now. I can't see any error. Anyone else able to see it?


PHP Code:
function total_page_views(){

    global 
$path_totusers_txt;

    
$totuser_handle fopen($path_totusers_txt'r+') or die("can't open file");
    
flock ($totuser_handleLOCK_EX); 
    
    if (
filesize($path_totusers_txt) > 0){
    
$totusers fread($totuser_handlefilesize($path_totusers_txt));
        
$totusers ++;
    }else{
    
$totusers 1;
    }

    
$totuser_handle fopen($path_totusers_txt'w+') or die("can't open file");
    
fwrite($totuser_handle$totusers);    
    
    
flock ($totuser_handleLOCK_UN);
    
fclose($totuser_handle);

    return 
$totusers;

}

function 
print_visitors_header(){

    
$visitors_now count_visitors_now();
    
$most_visitors most_visitors_online($visitors_now);
    
$tot_views total_page_views();

    echo 
'<div id="top">';
    echo 
'<span class="date2"></span>';
    echo 
'<span class="topic2">';
    echo 
'[ Visitors now: ' $visitors_now ', most users online: ' $most_visitors ', total page views: ' $tot_views ', week: ' date("W") . ' ]';
    echo 
'</span></div>';



PS: don't comment on all the echos on the end there..


- ØØ -