PDA

View Full Version : Adding a counter


allenz
9-1-02, 10:16 AM
I can't seem to find the code for adding a counter to my pages. I would prefer to ad a seperate counter to each page.

I don't use Front Page.

Could someone point me to the counters and codes if there are any on Power Web?

Thanks
Allen

George
9-1-02, 11:24 AM
Powweb offers a counter.
You can find it at http://resources.powweb.com/Online_Tools/counter.htm
It's a very simple one but you can enhance it with little effort.
For example, you can change the width and color of the border changing the script in this way:

#!/usr/bin/perl

open(FILE, "+<./sillycount_countfile");
flock(FILE, 2);
($number,$remote) = split(/:/, <FILE> );

$number++ if $remote ne "$ENV{'REMOTE_ADDR'}";

print "Content-type: text/html\n\n";
print "<table border=3 cellspacing=0 width=10% bordercolorlight=#FF0000 bordercolordark=#800000><tr><td bgcolor=#000000><center>
<font face=\"Arial,Helvetica\" color=#FFFFFF size=+0>$number</font>
</center>
</td></tr></table>
<!-- Want a counter like this? Check out
http://resources.powweb.com/tools/ -->";

truncate(FILE, length("$number:$ENV{'REMOTE_ADDR'}"));
seek(FILE, 0, 0);
print FILE "$number:$ENV{'REMOTE_ADDR'}";
close(FILE);
exit();

If you want to see the results, just go to http://nairobi.hushport.net/delivery2.htm
If you want to change the number the counter will begin from, just input the number you want (no commas nor other strange characters) in the sillycount_countfile.
You can have multiple sillycount... files (named sillycount1..., sillycount2... and so on, with multiple scripts to have a different counter for each page.
George

George
9-1-02, 11:30 AM
One more thing. Powweb counter says you must rename your pages to shtml extension to put the counter to work.
You can do another thing. Add these two lines to your .htaccess file:

AddHandler server-parsed .htm
Options +Includes

Then the counter will work in a normal htm page (if your pages have the html extension, just replace "htm" with "html").
George

walbar
9-1-02, 01:17 PM
I was also thinking of adding a counter similar to the one supplied by Bravenet (since the webalizer is not alway up to date.
I was just going to embed it in my present html coding.

Are you sayin I have to modify my site just to include a counter?

allenz
9-1-02, 05:17 PM
Thanks George for the help. I understand, however what I don't understand is "Chmod the file 755 " and the other Chmod. What's chmod.

Thanks
Allen

alphadesk
9-1-02, 05:19 PM
Here's a little something that will help you understand chmod/set permissions.
http://help.powweb.com/tutorials/ftp/chmod.php

allenz
9-1-02, 10:35 PM
Thank you all for your help.
Allen

larrymg
9-2-02, 03:38 AM
Can anyone show me how to make the counter described in this thread invisible to a viewer and accessible only to me? Thanks in advance for any assistance.