Results 1 to 2 of 2

Thread: [RESOLVED] Increases by 2.

  1. #1

    Thread Starter
    Retired G&G Mod NoteMe's Avatar
    Join Date
    Oct 2002
    Location
    @ Opera Software
    Posts
    10,190

    Resolved [RESOLVED] Increases by 2.

    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..


    - ØØ -

  2. #2

    Thread Starter
    Retired G&G Mod NoteMe's Avatar
    Join Date
    Oct 2002
    Location
    @ Opera Software
    Posts
    10,190

    Re: [RESOLVED] Increases by 2.

    For some reason an empthy varaible in the function over this one made the **** up...no idea how...but it is working now...


    - ØØ -

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width