PDA

Click to See Complete Forum and Search --> : a Non visible counter on my site.


michelle
Jan 9th, 2000, 03:58 AM
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.

vbsquare
Jan 9th, 2000, 04:05 AM
Are you running on a web server with ASP support?

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

B4
Jan 9th, 2000, 05:11 AM
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

sydneyfong
Jan 9th, 2000, 08:25 PM
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).]

vbsquare
Jan 10th, 2000, 12:19 AM
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!"

vbsquare
Jan 11th, 2000, 03:01 AM
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).]