Close

Results 1 to 8 of 8

Thread: counters

  1. #1
    DF VIP Member bean_2k1's Avatar
    Join Date
    Jan 2001
    Location
    Walsall
    Posts
    901
    Thanks
    0
    Thanked:        0
    Karma Level
    354

    Default counters

    where the best place to get one i need a small one not that big on the page any ideas ?

  2. #2
    DF VIP Member WTD's Avatar
    Join Date
    Mar 2001
    Location
    Tokyo, Japan
    Posts
    3,256
    Thanks
    0
    Thanked:        0
    Karma Level
    492

    Default

    Heres a really simple one I wrote in PHP.

    PHP Code:
    <?php
    $counter 
    "count_data.txt";

    if (
    file_exists($counter)) {
        
    $fp fopen($counter"r+");
        
    flock($fp1);
        
    $count fgets($fp4096);
        
    $count += 1
        
    fseek($fp,0);
        
    fputs($fp$count);
        
    flock($fp3);
        
    fclose($fp);
    } else {
        echo 
    "Can't find file, check '$counter' exists and is chmod 777";
        die() ;
    }

    ?>

    <?php echo $count?> impressions on this page.
    You need to create a file called count_data.txt in the same directory as this count.php

  3. #3
    DF VIP Member bean_2k1's Avatar
    Join Date
    Jan 2001
    Location
    Walsall
    Posts
    901
    Thanks
    0
    Thanked:        0
    Karma Level
    354

    Default

    thanks for the reply mate ill have ago at it tomorrow when i come back from collage

  4. #4
    DF VIP Member WTD's Avatar
    Join Date
    Mar 2001
    Location
    Tokyo, Japan
    Posts
    3,256
    Thanks
    0
    Thanked:        0
    Karma Level
    492

    Default

    Any probs give us a shout mate

  5. #5
    DF VIP Member bean_2k1's Avatar
    Join Date
    Jan 2001
    Location
    Walsall
    Posts
    901
    Thanks
    0
    Thanked:        0
    Karma Level
    354

    Default

    yeah just tryed it works great thanks

  6. #6
    DF Member zulu95e's Avatar
    Join Date
    Jun 2001
    Location
    UK
    Posts
    41
    Thanks
    0
    Thanked:        0
    Karma Level
    0

    Default

    @WTD
    Hi WTD. Just found your post on php and as a complete newbie to web design I was wondering how to incorporate this into a webpage? I’ve tried creating a blank webpage and inputting the code in-between the body /body tags but all that happens when I open it is a page with "impressions on this page" at the top, any help would be appreciated.

    Thanks for your time

    Brian

  7. #7
    DF VIP Member WTD's Avatar
    Join Date
    Mar 2001
    Location
    Tokyo, Japan
    Posts
    3,256
    Thanks
    0
    Thanked:        0
    Karma Level
    492

    Default

    Does your host support PHP?

  8. #8
    DF VIP Member bean_2k1's Avatar
    Join Date
    Jan 2001
    Location
    Walsall
    Posts
    901
    Thanks
    0
    Thanked:        0
    Karma Level
    354

    Default

    you must upload it to your webspace and make sure your change the txt to chmod 777 else it wont work like i found out

Similar Threads

  1. Cigarettes to be sold under shop counters
    By Mule in forum News & Current Affairs
    Replies: 16
    Last Post: 25th March 2008, 09:07 PM
  2. Calorie Counters
    By Ganty in forum Health & Fitness
    Replies: 4
    Last Post: 28th April 2007, 12:58 PM

Social Networking 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
  •