Results 1 to 6 of 6

Thread: a Non visible counter on my site.

  1. #1

    Thread Starter
    Hyperactive Member
    Join Date
    Jul 2002
    Location
    Canada
    Posts
    455

    Post

    Is it possible to create on my web site a non visible counter? (a counter who counts how many times the site is visited.)

    Nice greetings,

    Michelle.

  2. #2
    Addicted Member
    Join Date
    Jan 1999
    Posts
    173

    Post

    Are you running on a web server with ASP support?

    ------------------
    "To the glory of God!"


  3. #3
    Junior Member
    Join Date
    Dec 1999
    Posts
    22

    Post

    As long as your webserver supports Perl you can do this in Perl very easily like this:

    #!/usr/bin/perl

    print "Content-type: text/html";
    open (FH, "+<counter.txt");
    $count = <FH>;
    $count++;
    print FH $count;
    close(FH);
    print "I have had $count visitors";
    exit;

    Also, you will need to create a file called "counter.txt" with the begining count value (such as 0) in it.

    -B4

  4. #4
    New Member
    Join Date
    Jul 1999
    Location
    HKSAR
    Posts
    9

    Post

    Wow, first there's a Web question, then a Perl answer... (and here comes an HTML answer) this is a VB site...

    Anyway, here is a "dirty trick" to do the job if you don't have ASP or Perl or whatever CGI support at your site... (works only if your counter is an image )

    in the counter HTML code, find the <img> tag

    inside it, add

    height="0" width="0"

    for example :
    <img src="http://freecounters.com/userid?=1234" width="0" height="0">

    Also, if there are no <img> tags in the code :

    try this .works only for version 4+ browsers though (yeah, ain't any cure for older browsers if the above solution don't work)

    <span style="position:absolute;visibility:hidden">
    <layer left=-300 top=-300>

    * the counter source code *

    </layer>
    </span>

    [This message has been edited by sydneyfong (edited 01-10-2000).]

  5. #5
    Addicted Member
    Join Date
    Jan 1999
    Posts
    173

    Post

    I have sent you an email with a full ASP sample that also allows you to get the counter value from VB.

    ------------------
    "To the glory of God!"


  6. #6
    Addicted Member
    Join Date
    Jan 1999
    Posts
    173

    Post

    Hi,
    In case you tried the Perl script, I couldn't get it to work. So here is a version I put together that seems to work for me:

    NOTE: Change the path to perl as appropriate and also remove the hash sign before the print $count; line if you want to show the value.

    #!/usr/bin/perl -T
    print "Content-type: text/html";

    open (COUNT,"+< counter.txt");
    $count = <COUNT>;
    close(COUNT);
    $count++;
    open(COUNT,"+< counter.txt");
    print COUNT "$count";
    close (COUNT);
    #print $count;
    exit;


    ------------------
    "To the glory of God!"



    [This message has been edited by vbsquare (edited 01-11-2000).]

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