Reprint of CGI Access Counter TcounT 4 Released – Added Double Count Prevention Function, Remade as T-Count Ver.4.20+ 【Free CGI Redistribution・Download】

update Last updated: March 31, 2023 at 2:32 AM

Takahiro Nishida is releasing a reprint of the following multifunctional graphic CGI access counter "TcounT 4" that was released in 1998 and disappeared from the Internet. CGI programs have been remade with a UTF-8 coding scheme.
This access counter can be installed in three types of counters (General, Today, and the Day Before) on multiple pages in one CGI program.
The CGI program (perl language) to be released adds a function to prevent double counting during continuous access by checking the IP address, and the latest version of Perl 5.26 support, numeric images (9 types) and are also included.

【Software name】 TcounT 4
【Version】 4.20
【Type】 CGI Counter
【Development】 T (
【Posted】 MyTools.NET (
【Latest version】
【Copyright】 Reproduction, modification, redistribution all free (please see the Terms of Use for details)
* Please contact us when posting in magazines, CD-ROMs, or other commercial media.

As for the access counter, please refer to KENT-WEB's Dream Counter Various CGI programs such as these are on the market.
For that reason, I thought that the old access counter program was not necessary now, but when I looked it up, it seems that there are not many CGI programs that can install three types of counters (comprehensive, today, and the day before) on multiple pages.
Therefore, in order to preserve the old software assets, we added some functions to the conventional program and decided to release it in the form of a redistribution of "TcounT 4 Version 4.20+".

In addition, we have confirmed the existence of "T-Count Ver.5.03" as a successor version of "TcounT 4", but the distribution site was closed a long time ago and it is difficult to obtain now (Takahiro Nishida's survival is also unknown), so this time we will release it based on version 4.
Regarding T-Count Ver.5.03, we expect it to be provided by those who are currently using it.*

Access counters are now regarded as a retro culture of the Heisei era, but I would like to keep this software, which is already becoming an endangered species.

* 2022.09.25 update
Receiving information from users T-Count 5 (reissue version) has been released.

Features of TcounT 4 Reprint

The above image is an example of displaying three types of counters (General, Today, and the Day Before) in "TcounT 4 Reprint". This page also displays the modified date and time of the specified file by SSI.
If you want this screen to appear on the WordPress home page, you can do so by defining an iframe in the theme's program front-page.php and calling "view-counter.shtml" as shown in the following example.

<iframe src="" name="counter" width="100%" height="100" seamless="seamless" scrolling="NO" align="middle" frameborder="0">この部分はインラインフレームを使用しています。</iframe>

* For reference, view-counter.shtml is written as follows.
As with the HTML below, this CGI program was released with the utf-8 code system. Currently, all CGI programs have been rewritten in utf-8 code system, considering that the transition to utf-8 is progressing, which is compatible with pictograms and avoiding garbled characters such as "display".

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
*  Function               : Access counter display for WordPress
*  Designed & Written by  : Senri
*  Release date           : 2015/01/12
*  Last modified          : 2020/02/11 SSL compatible.
*  Copyright (C) 2015-2020 Senri. All rights reserved.
<TITLE>View Counter</TITLE>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta http-equiv="Content-Style-Type" content="text/css">
<style type="text/css">
	font-size: 12px;

<body bgcolor="#000000" text="#999900">
<div align="center">
  <table border="0">
        <td><nobr><font face="Times New Roman" style="font-size : 80%;">Visitors:</font></nobr></td>
        <td><IMG src="" align="middle" height="25" width="80"></td>
        <td><nobr><font face="Times New Roman" style="font-size : 80%;">Since 28 August 2022</font></nobr></td>
<div align="center">
  <table border="0">
        <td><nobr><font face="Times New Roman" style="font-size : 80%;">Today:</font></nobr></td>
        <td><IMG src="" align="middle" height="20" width="60" border="0"></td>
        <td> </td>
        <td><nobr><font face="Times New Roman" style="font-size : 80%;">Day Before:</font></nobr></td>
        <td><IMG src="" align="middle" height="20" width="60" border="0"></td>
        <td colspan="6" align="center" valign="bottom" height="25"><nobr><font face="Times New Roman" style="font-size : 85%;">⏰ <i>Last Modified: <!--#config timefmt="%e %B %Y at %H:%M"--><!--#flastmod virtual="/index.php"--></i></font></nobr></td>

2023.03.09 update
The above HTML is written in the old format of HTML4, and includes font tags and i tags that have been abolished in HTML5, so it is desirable to modify it to the new format. In the article of "T-Count 5 Ver. 5.03+", which is the successor to "Tcount 4", the corrected version is released as follows.

* If you want to access pages other than the top page in WordPress, write it as shown in the following example in the theme program header.php.

		<!-- #header-image -->
		<?php if ( is_front_page() || ( get_option( 'show_on_front' ) == 'posts' && is_home()) ) : ?>
			<!-- フロントページ or ブログ投稿インデックスページ -->
			<div id="hpb-header-image"><img alt="千里のポータルサイトへようこそ!" src="<?php echo get_template_directory_uri(); ?>/header-main.jpg"></div>
		<?php else: ?>
			<!-- アクセスカウンタのCGI呼び出し(TOP以外のページ) -->
			<IMG src="" height="0" width="0">
		<?php endif; ?>

The following are edited and added based on the previous TcounT 4 manual.

◆ TcounT Ver.4.20 (reprint) manual

I often see graphical access counters that use SSI or output the entire page as CGI, but this is a counter that is pasted into ordinary HTML with img tags.
TcounT Ver.4.20 has the following features: (★ is a new feature added in the reprint)

・ Because it is CGI, it can be used even on servers that can not use SSI
・ Multiple counters can be moved with one program
・ Since it is only pasted with img tags, it is easy to design the page
・ You can display, add, modify, delete, etc. counters from the management page
・ You can display and clear the daily counting log from the management page
You can use your favorite gif file for numeric images
・ It is possible to change the image for each counter
・Aggregate the number of accesses per day
・ The number of counts of the previous day can be displayed
・ Today's count number can be displayed
★ Prevent double counting during continuous access by checking IP addresses
★ Perl 5.26 support
★ Includes 9 numeric images and the latest version of
★ Responding to time differences when operating on overseas servers


Download here 👉 📥

tcount.cgi ... substance
tcadmin.cgi ... Administrative
tclog.cgi ... for viewing logs ... Library for Linking GIF Images (Ver1.61) Copyright © 1997-2002 杜甫々
★ MyTools_NET – TcounT Ver_4_20.htm ... Previous "TcounT 4" manual
★ TCounts.cgi ... Text counter display (this is an omake)


Download four files from the source: tcount.cgi, tcadmin.cgi, tclog.cgi, and

.cgi Set the Perl path at the top of the file correctly.

Edit the following variables in the .cgi file: ★ After editing, save with UTF-8 (no BOM) character encoding.
(1) tcount.cgi、(2) tcadmin.cgi、(3) tclog.cgi

$basedir ..... Path of the directory where the data file is stored (*Note 1)(1)(2)(3)
$ext ..... CGI Program Extensions (2)(3)
$topurl ..... Return URL(2)
$password ..... Administrative password, default = "password" (2)
$method ..... How to submit a form (*Note 2) (2)
$TZ ..... Time difference (GMT+s) – Initial value = +9*3600(Japan time) (1) ★
$itvl ..... Interval (seconds) to skip countup for consecutive accesses of the same IP address, initial value = 60 ★ (1)

*Note 1 When placing the data file in the same location as the program, $basedir = "."; Remain as it is.
*Note 2 If "post" is not available, please change it to "get".

.cgi. Transfer the pl file in FTP ASCII mode and set ~.cgi to 705 and to 604.

★ In the following, the operation with telnet is described in detail, but basically, after transferring the file downloaded and unzipped from this site to the server by FTP as it is, the installation is completed just by setting the permission.

(For telnet)
% chmod 705 tcount.cgi
% chmod 705 tcadmin.cgi
% chmod 705 tclog.cgi
% chmod 604
Create three empty files: tclog.txt, tcmtime.txt, and tccomp.txt.

The three .txt files created above in the directory specified by $basedir ( $basedir="."; Same directory as above. And so on. ascii transfer by FTP to. Set all permissions to 606.
(For telnet)
% chmod 606 tclog.txt
% chmod 606 tcmtime.txt
% chmod 606 tccomp.txt

In the same directory as above, create the directories data, gif, and lockdir. Set all permissions to 707.
(For telnet)
% mkdir data
% mkdir gif
% mkdir lockdir
% chmod 707 data
% chmod 707 gif
% chmod 707 lockdir

Change to the directory data and create the directories all, day, and today. The permission should be 707.
(For telnet)
% cd data
% mkdir all
% mkdir day
% mkdir today
% chmod 707 all
% chmod 707 day
% chmod 707 today

Change to directory gifif and create directory img. The permission should be 707.
(For telnet)
% cd .. /gif
% mkdir img
% chmod 707 img
In the directory img, transfer binary files with numeric image files by FTP. The numeric file name shall be 0.gif, 1.gif, ~, 9.gif. Set the permission to 604.
(For telnet)
% cd img
% chmod 604 *.gif
The numeric image is HoloNet Home Page There are a lot of them. If you don't like it, you can create it yourself.

* Depending on the type of GIF, it may not be displayed normally. For details Causes of image collapse See also If you want to create your own, please read this caution carefully.

Try accessing tcount.cgi from a browser.
→ OK if "Parameter is incorrect" is displayed.
* If it is not displayed as above, please solve the problem by referring to Accessing with a browser.
Try accessing tcadmin.cgi from a browser.
→ If the administration page is displayed, it is OK.
This completes the installation.

Turn on the counter

Decide on a name for the new counter. (In this case, the file name is counted as an example.) )
* Please use a combination of half-width English and half-width numbers (top, link, etc.) for the name of the counter. Symbols such as hyphens (-) are not allowed.

FTP an empty file named count.txt under the directory data/all/. Set the permission to 606.
(For telnet)
% chmod 606 data/all/count.txt

Also under the directory data/day/, FTP an empty file named count.txt. Set the permission to 606.
(For telnet)
% chmod 606 data/day/count.txt

Also under the directory data/today/, FTP an empty file named count.txt. Set the permission to 606.
(For telnet)
% chmod 606 data/day/count.txt

Access the administration page (tcadmin.cgi) and select "Create a new counter". Set the file name (in this case, count), initial value, enter the password, and press "Execute".
→ OK if a newly created counter is added to "Current count status".
Click each of the test marks (■▲▼●) for the current count status.

The operation when each mark is pressed is as follows. (Just in case, please check everything.) )
■ → Overall count
▲ → Overall count, increased by 1
▼ → Number of counts for the previous day
● → Today's count
* If it does not go well, an error message will be issued, so please read the contents and deal with it.
★ For the total number of counts, increase by 1 (▲), follow the setting of $TZ. If you do not want to counter up, delete the IP address check file (.data/all/[Count Name] _IP.txt) and run it again.

Write the following in the place where you want the counter to appear on the page:

<IMG SRC="(tcount.cgiのURL)?count&1" WIDTH="80" HEIGHT="21">

* The URL is a relative path (.. /tcount.cgi etc.) or an absolute path (http://~/tcount.cgi). And so on.
* For WIDTH, write the number of digits × (width of the gif file) (5 digits in the standard), and the height of the gif file should be written for HEIGHT. How to change the number of display digits will be described later.

Write the following in the place on the page where you want to display today's count:

<IMG SRC="(tcount.cgiのURL)?count&&3&&today" WIDTH="48" HEIGHT="21">

* The 3-digit display is shown here as an example. Same with the bottom.

Write the following in the place on the page where you want to display the count of the previous day.

<IMG SRC="(tcount.cgiのURL)?count&&3&&day" WIDTH="48" HEIGHT="21">

Try FTP the page to the server and see if it appears. Check to see if the numbers increase when you reload.

Add a counter

Decide not to duplicate the name of the new counter with the previous one. (Since count was used earlier, let's use count2 here.) )
After that, it is the same as putting the counter on top. Replace the part that was count(.txt) with count2(.txt).
The tag looks like this:

<img src="(tcount.cgiのURL)?count2&1" width="80" height="21">

Directory diagram

The overall directory structure of the work done so far looks like this: ($basedir=”.”; )
※ カッコ内の数字はパーミッション。<~>はディレクトリ。

+ tcount.cgi (705)
+ tcadmin.cgi (705)
+ tclog.cgi (705)
+ (604)
+ tclog.txt (606)
+ tccomp.txt (606)
+ tcmtime.txt (606)
+ <lockdir> (707)
+ <data> (707)
|     + <all> (707) ★(注)
|     |     + count.txt (606)
|     |     + count2.txt (606)
|     + <day> (707)
|     |     + count.txt (606)
|     |     + count2.txt(606)
|     + <today> (707)
|           + count.txt (606)
|           + count2.txt(606)
+ <gif> (707)
      + <img> (707)
            + 0.gif (604)
            + 1.gif (604)
            + ...
            + 9.gif (604)

★ Note: When access occurs, count_IP.txt, count2_IP.txt, ... will be created automatically.


■ Meaning of parameters
TcounT manipulates the movement of counters by placing parameters after the URL of the tcount.cgi. The parameters are specified as follows.

<IMG SRC="tcount.cgi?(1)&(2)&(3)&(4)&(5)">

(1) ... Counter Name (required)
(2) ... Increase the number → "1" (does not increase if nothing is specified)
(3) ... The number of digits to be displayed (5 digits if not specified. If it can not be displayed, it will increase to the point where it can be displayed)
(4) ... Image directory name ("img" if not specified)
(5) ... Today→ "today", the previous day→ "day" (or the total count if nothing is specified)
途中のパラメータを跳ばしたい場合は、”tcount.cgi?test&&&&day” という具合に、 & を続けて書いて下さい。

● Change the number of digits displayed
To specify the number of digits to display, write the number of digits in the third part of the parameter.
(Example) If you want to make it 3 digits

<img src="(tcount.cgiのURL)?count&1&3" width="48" height="21">

* If nothing is specified, it will be 5 digits.
* If you change the number of digits, don't forget to change the width accordingly.
* If it is not possible to display it completely, the number of digits will increase to the point where it can be displayed. (For example, if the third parameter is 3 but the count is 2234, it is displayed as 4 digits.) )

● Change the numerical image
Numeric images can be used as GIF files as you like.
※ Regular GIFs are recommended. Video GIFs and transparent GIFs may be displayed in a broken display. For details Causes of image collapse See also

The procedure is as follows.

Prepare the GIF image you want to use. The names should be 0.gif, 1.gif, ... , 9.gif.
Create a directory with an appropriate name under directory gif. Set the permission to 707 (for example, img2).
% cd gif
% mkdir img2
% chmod 707 img2
Under the newly created directory (in this case, img2), transfer 0.gif, 1.gif, ... , 9.gif binary by FTP. Set the permission to 604.
% cd img2
% chmod 604 *.gif
The fourth parameter specifies the directory name.
Example: When you want to use images from the directory gif/img2/ (6-digit display)

<img src="(tcount.cgiのURL)?count&1&6&img2" width="96" height="21">

* If nothing is specified, the image file under img is used.

● Display the number of accesses for the previous day
To display the number of accesses for the previous day, write day as the fifth of the parameters.
(Example) (3-digit display, using images in the directory gif/old/)

<img src="(tcount.cgiのURL)?count&&3&old&day" width="48" height="21">

● Display today's number of accesses
To display today's number of accesses, write today as the fifth of the parameters.
(Example) (3-digit display, using images in the directory gif/old/)

<img src="(tcount.cgiのURL)?count&&3&old&today" width="48" height="21">

■ Example parameter specification and actual display
In the following, we assume that the position of the program (tcount.cgi) is /cgi-bin/count/tcount.cgi. If it is on a different server, specify it with an absolute path starting with http://.

● Example 1 (counter name: test1)

<IMG SRC="/cgi-bin/count/tcount.cgi?test1&1" WIDTH="80" HEIGHT="21">

It is an ordinary installation method. If no parameters are specified, 5-digit display and images are used for gif/img/.
* If you do not specify the size of the image file as WIDTH and HEIGHT, the HTML below it will not be displayed until the numeric image is loaded, so be sure to specify it.

● Example 2 (counter name: test2, 8 digits)

<IMG SRC="/cgi-bin/count/tcount.cgi?test2&1&8" WIDTH="128" HEIGHT="21">

If it is 8 digits, the third parameter is set to 8. Don't forget to change the WIDTH to fit the number of digits.

● Example 3 (counter name: test3, 5-digit display, using image of gif/ball/)

<IMG SRC="/cgi-bin/count/tcount.cgi?test3&1&5&ball" WIDTH="120" HEIGHT="24">

To change the image, specify the directory name where the image file is located in the fourth part of the para.meter.

● Example 4 (counter name: test1, number of accesses from the previous day, 3-digit display, using gif/old/ image)

<IMG SRC="/cgi-bin/count/tcount.cgi?test1&&3&old&day" WIDTH="27" HEIGHT="13">

To display the number of accesses for the previous day, the fifth of the parameters is day. Use a smaller numeric image of the directory gif/old/.

● Example 5 (counter name: test1, number of accesses today, 3-digit display, using gif/old/ image)

<IMG SRC="/cgi-bin/count/tcount.cgi?test1&&3&old&today" WIDTH="27" HEIGHT="13">

To display today's number of accesses, the fifth of the parameters is today. (Ver.4.10 or later)

● Example 6 (counter name: hidden, hidden counter)

<IMG SRC="/cgi-bin/count/tcount.cgi?hidden&1&&dmy" WIDTH="5" HEIGHT="5">

Make a small gif image of a solid color, put it in the directory gif/dmy/ with the names 1.gif, 2.gif, ... , 9.gif (all the contents are the same), and specify dmy as the fourth parameter (the numeric image to be used). On the surface, it doesn't look like a counter, but the admin page and statistics record counts.

■ View daily counting logs
Daily statistics can be viewed by accessing tclog.cgi. Here's how to look at it:

NameFile Name
DayCounts per day
ALLNumber of counts to that day

■ Modify the count count
Go to the administration page (tcadmin.cgi) and select "Modify Counter". Enter the file name, modification value, and password, and press "Execute".

■ Delete a counter
Go to the administration page (tcadmin.cgi), select "Delete counter", enter the file name and password, and press "Execute".
※ ファイルの削除は手作業で行なう必要があります。data/all/、data/day/、data/today/ の <カウンター名>.txt を消去して下さい。

■ Clear the daily counting log
If you leave the counter log alone, it will accumulate more and more, so please clear the log in a timely manner.
Go to the administration page (tcadmin.cgi).
Select "Clear counter log".
Enter your password and press "Execute".
→ OK if "Counter log cleared" is displayed.


■ Causes of image collapse
TcounT can also use GIF images created by yourself, but it seems that the display may be broken depending on the file. The GIF concatenation part uses a generic library. I can't respond because I don't understand its contents. Statistically, it seems that the following images often do not work.

・ Video GIF (Animation GIF) ... Symptoms such as not moving or not being displayed appear.
・ Transparent GIF with different transparent specified color ... If it is not uniform, symptoms such as not being transmitted and color collapsing will appear.
- GIFs with different pallets ... If you do not unify the palette, the color will collapse.

When creating your own, please do not create images like the one above. ( HoloNet Home Page The image of is mostly displayed normally. If you want to make your own, please refer to how to use the palette. )
★ You can 👉 also get GIF images on this page Digit Mania

※ However, even if none of the above causes apply, the display may collapse. If you try to use it and it collapses, it is faster to give up and make another image.

About TcounT administration pages
When the administrative page of "TcounT 4" is registered in Google index, etc., it includes information that is undesirable for users to see, such as file names and access logs.
In T-Count Ver.5.03, access to information is restricted by password when viewing, but in TcounT 4, the information is fully visible.
Therefore, in order to prevent administrative pages from being indexed by search engines, we recommend that you set the following access restrictions in robots.txt etc.

User-agent: *
Disallow: /*.cgi$  # 全てのページでcgiプログラムのインデックス登録を拒否
Allow: /cgi-bin/abc/abc.cgi  # abc.cgiのインデックス登録を許可
User-agent: *
Disallow: /cgi-bin/TCount/  # TCountディレクトリのインデックス登録を拒否

Program Terms of Use and Disclaimer

This source is intended to be a redistribution (modified) version of the freeware, but the license provisions belong to the distributors "TcounT 4"* and "".
In addition, we are not responsible for any damage as a result of use, and we do not accept any support at all. (However, bug reports will be accepted.)

Please use this program after knowing the above in advance.

* Unfortunately, the distribution source of "Tcount 4" is no longer available.

TcounT 5 Reprint T-Count Ver.5.03+ Released

The successor version of "TcounT 4", "TcounT 5", has been remade with a function to prevent double counting, and T-Count 5 Ver.5.03+ has been released as a reprint. For more information, please see the article below.

Add this entry to the hasebookmark
X (post)

Leave a Reply