Advanced Search

Results 1 to 5 of 5

Thread: web counter

  1. #1
    Join Date
    Jun 2008
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default web counter

    hi...
    I need some help from you...I wanna make web counter on my website,can you help me....coz I have already done with my counter but it doesn't works good...help me plizz

  2. #2
    Join Date
    Jan 2008
    Posts
    4,158
    Thanks
    28
    Thanked 623 Times in 619 Posts
    Blog Entries
    1

    Default

    Heres a way to do it in PHP, on every page you want to put this code:
    PHP Code:
    <?php
    include('counter.php');
    ?>
    And then on counter.php:
    PHP Code:
    <?php
    function counter($file){
    $fdata fopen($file'w');
    $data file_get_contents($file);
    $newData $data+1;
    fwrite($fdata$newData);
    fclose($fdata);
    }
    counter('counter.txt');
    ?>
    You'll find a file that's automatically created called "counter.txt", thats where the number of hits you got are. Also it can be the same person refreshing there page rapidly. So I can create it so it only counts for one person once a day if you want. But tell me if you do.
    You can also take a look at this witch isn't what you wanted. But:
    http://www.dynamicdrive.com/forums/s...16&postcount=7
    Jeremy | jfein.net

  3. #3
    Join Date
    Jul 2007
    Location
    Azerbaijan, Baku
    Posts
    144
    Thanks
    11
    Thanked 27 Times in 25 Posts

    Default

    You can do it with db too.

    Like when press to link, call function. Then get old count and make $newcount = $oldcount+1;
    Only you will need is to update the count:

    $result = mysql_query("UPDATE counter SET count = '$newcount' WHERE id = '$id'");

    if you have question can ask ^^

  4. #4
    Join Date
    May 2013
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    hello... my question is ...
    how to know how many visitors already visited in my site....
    tell me, plz help me

  5. #5
    Join Date
    Apr 2008
    Location
    So.Cal
    Posts
    3,621
    Thanks
    63
    Thanked 516 Times in 502 Posts
    Blog Entries
    5

    Default

    ramaraju,

    Please start a new thread to ask your question.
    The last reply in this thread was almost five years ago - there is almost never an acceptable reason to post in such an old conversation.

    Read the Forum Rules before starting your thread.
    This thread is also a good place to learn about the rules here on DynamicDrive.

    If you are looking for a complete script that you can use, post in the Looking for such a script or service forum (or, read Nile's reply, above).
    If you are trying to write one yourself, post in the PHP forum.

    Quote Originally Posted by ramaraju
    how to know how many visitors already visited in my site....
    Note that it is not possible to determine how many visitors you have already had: any script will be able to record only subsequent visits.

    Also,

    Your question is unclear.
    Please provide more information, and be as specific as possible.
    • What do you want to accomplish?
    • What have you already tried?
    • What problems did you encounter?

    Please be sure that you have included all relevant code and/or a link to the page in question.
    You might also consider making a reduced test case using an online tool like jsfiddle
    Last edited by traq; 05-28-2013 at 05:13 AM.
    We Only Torture the Folks We Don't Like (You're Probably Gonna Be Okay)
    It's a Party in the CIA

Bookmarks

Posting Permissions

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