Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

need to create a counter with my own code.

Status
Not open for further replies.

parkfairfax

Programmer
May 22, 2001
63
US
Does anyone have any code for a javascript enabled counter that I could use for my home page. Reading through the various threads I see lots of similar requests, but no code has been provided. Like others, I would like to use my own code, not a third party site. if they go out of business than I would loose my count. I also don't want to promote someone elses software business, because we are developing a government site and there are restrictions against this.

Thank you,

G. Miller
 
Hi mate,

What do you want it to count?

Javascript is client side and therefor will not tell you how many people have been to your site, it can however tell how many times that user has visited..

Use a server side language if you want to count total visitors..

Hope this helps Wullie

 
cgi counter
#!perlpath
$file = "path://to//file";
open COUNTER, &quot;<$file&quot; || die &dead;
@counter = <COUNTER>;
close COUNTER;
$actual = $counter[0];
$actual++;
open COUNTERAGAIN, &quot;>$file&quot; || die &dead;
print COUNTERAGAIN &quot;$actual\n&quot;;
close COUNTERAGAIN;
print &quot;Content-type: text/html\n\n&quot;
print &quot;<html>....</html>&quot;;
exit;
# now the file contains the number of hit on this page
# i must agree with wullie js wont do the job here someone knowledge ends were
someone else knowledge starts
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top