Frequently asked questions about the Text Counter CGI script.
To set up the Text Counter:
Upload textcounter.pl to /cgi-bin/
chmod 755 textcounter.pl
echo "0" > counter.txt
chmod 666 counter.txt
<!--#exec cgi="/cgi-bin/textcounter.pl"-->
If your counter isn't incrementing, check these issues:
Test by running:
ls -la counter.txt
cat counter.txt
To reset the counter to zero:
echo "0" > counter.txt
To set a specific starting value:
echo "1000" > counter.txt
Yes! There are two methods for multiple counters:
Copy the script for each page:
textcounter_home.pl -> home_count.txt
textcounter_about.pl -> about_count.txt
Use one script with a page parameter:
<!--#exec cgi="/cgi-bin/textcounter.pl?page=home"-->
<!--#exec cgi="/cgi-bin/textcounter.pl?page=about"-->
The script then creates separate count files for each page.
Customize the display by modifying these variables:
# Add leading zeros
$min_digits = 6; # 000123
# Add commas
$use_commas = 1; # 1,234,567
# Custom text
$prefix = "Visitors: ";
$suffix = " since Jan 2024";
Example outputs:
1234501234512,345Visitors: 12,345 since Jan 2024To exclude your own visits, add your IP to the ignore list:
@ignore_ips = (
"123.45.67.89", # Your home IP
"98.76.54.32", # Your work IP
"192.168." # Local network prefix
);
You can also use:
"123.45." matches all in that rangewhatismyip.com and add it to the list.