Beginner PHP Tutorial – 92 – Creating a non-unique Hit Counter

[ad_1]
Facebook –
GitHub –
Google+ –
LinkedIn –
reddit –
Support –
thenewboston –
Twitter –


Posted

in

by

Tags:

Comments

25 responses to “Beginner PHP Tutorial – 92 – Creating a non-unique Hit Counter”

  1. Imroz Wana Avatar

    Warning: fread(): Length parameter must be greater than 0 in C:xampphtdocshitcounternonunique.php on line 7

    Warning: fwrite(): supplied resource is not a valid stream resource in C:xampphtdocshitcounternonunique.php on line 12

    Warning: fclose(): supplied resource is not a valid stream resource in C:xampphtdocshitcounternonunique.php on line 13

  2. Nisad Rehman Avatar

    My code non unique hit counter
    <?php
    $hit = file_get_contents("hc.txt");
    $hit+=1;
    echo "Total hit: ". $hit;
    file_put_contents("hc.txt",file_get_contents("hc.txt")+1);
    ?>

  3. Owaiz Yusufi Avatar

    how can we do this by clicking a button

  4. Nadeem Khalani Avatar

    what hitcounter is exactly isn't it folder how we can view output in folder(where the file system lies)

    aren't we suppose to view output in some xyz file….!!!!

  5. amith murakonda Avatar

    Using a session variable is much better right

  6. V. Peters Avatar

    <?php

    function hit_count() {
        $filename = 'count.txt';
        $handle = fopen($filename, 'r');
        $current = fread($handle, filesize($filename));
        $fclose($handle);
        
        $current_inc = $current +1;
        
        $handle = fopen($filename, 'w');
        fwrite($handle, $current_inc);
        fclose($handle);
        
            
            }

    ?>

  7. V. Peters Avatar

    the solution is on the Youtube side….. faster talking, slower talking. youtube should be able to speed-up or speed-down video's by milliseconds…… who agrees?

  8. malnoor83 Avatar

    the speed of talking is fast to comprehend the tutorial 
    but it is ok , thanks .

  9. Dankest Elf Avatar

    Combine this with that IP recognition tutorial, and BAM! You got yourself a badass unique hit counter 🙂

  10. Rijin Mk Avatar

    What a stupid question!?

  11. ThatRandomNoob Avatar

    $current++ increments after the command. It still increments but if you echo out the value before it increments it won't appear to

  12. Rahil Wazir Avatar

    i don't know why people say slow down its a video there are options of pausing and replaying the video NOOOBS

  13. Jonathan Hilfiker Avatar

    this was a pretty easy example for anyone who has programmed before.

  14. Mark Christoper Vizcarra Avatar

    When he is slow.. someone complain, if he is a little fast.. someone complain. He can't win.

  15. LetsSpotIt Avatar

    why filesize($filename) returns 1000? shouldn't it be like 4 byte?

  16. ALI MUNTH Avatar

    @thesickbeat GFYS

  17. thesickbeat Avatar

    @alimunth How about you GET a life first? EAT MY FIST, ASSHOLE.

  18. 0mar_little Avatar

    By the moment I'm writing this all the 200 videos have been uploaded. I'd rather watch as many as I want instead of wanting to see another but not being available.
    That's my opinion at least.
    Thank you Alex and Bucky.

  19. Mike Flannigan Avatar

    @xFelicianoX
    He's in it for the money, otherwise we can all fuck off for all he cares. c:

  20. Kyperbelt Avatar

    @xFelicianoX i would rather have them all at once so my learning does not halt 😀

  21. xFelicianoX Avatar

    @Nahiyan12 That doesn't mean he has to upload them all in under 3 days

  22. Nahiyan Alamgir Avatar

    @xFelicianoX

    Actually all the tutorials were sent to Bucky by Alex and Bucky just uploaded them all.

  23. Dalwanaage Avatar

    @xFelicianoX
    Man silly question get no answer.

  24. xFelicianoX Avatar

    Why are you uploading like 30 tutorials per day

Leave a Reply

Your email address will not be published. Required fields are marked *