Make your own free website on

Ccount 1.1
PHP click counter

PHP click counter (Ccount)
Version: 1.1 from 22nd January 2005
Originally written on 13th July 2004 by Klemen Stirn (info AT phpjunkyard DOT com) - Free PHP scripts
PHP click counter
Support and developers forum

PLEASE NOTE: I cannot provide free installation support for this free script! Please use the above e-mail address to contact me ONLY about possible bug reports, suggestions or comments! Thank you!


Copyright 2004 Klemen Stirn. All Rights Reserved.

The Ccount may be used and modified free of charge by anyone so long as this copyright notice and the comments above remain intact. By using this code you agree to indemnify Klemen Stirn from any liability that might arise from it's use.

Selling the code for this program without prior written consent is expressly forbidden. In other words, please ask first before you try and make money off this program.

Obtain permission before redistributing this software over the Internet or in any other medium. In all cases copyright and header must remain intact. This Copyright is in full effect in any country that has International Trade Agreements with the United States of America or with the European Union.

Removing copyright notice ("Powered by" statement)
Removing any of the copyright notices without purchasing a license is illegal! To remove PHPJunkyard copyright notice you must purchase a license for this script. For more information on how to obtain a license please visit the site below:


Ccount is a PHP click counter. With its help you can count clicks on any link on your website. A great tool if you want to know how many times a link has been clicked, a file downloaded and similar. You can also hide your affiliate links with PHP click counter. As long as it's a link - Ccount can count clicks on it!


>> Quick installation

Open file settings.php in your favorite PLAIN TEXT editor (like Notepad or Wordpad on Windows systems, DO NOT use MS Word or similar editor) and set these variables:

Save and close the settings.php file. There are some more options in the settings.php file, set them if you are an advanced user only.

Go to your FTP client and FTP to the public directory on your server (where the rest of your website is; usually "public_html", "www" or "site") and create a folder where you will install Ccount.
Example: /public_html/ccount
Corresponding URL:

Upload all Ccount files to this folder. Images (line.gif,reset.gif,delete.gif) must be transferred in BINARY mode, other files in ASCII mode (refer to your FTP client instructions for details on how to set transfer mode properly).

Make sure that the PHP scripts have permission to write to files clicks.txt and ids.txt - on UNIX (Linux) servers you must CHMOD (set permissions for) these two files to 666 (rw-rw-rw).

If you have done all this your script should work now. In your browser open folder where you have installed Ccount, for example:

Type in the password you set in settings.php, click Enter admin panel and voila, you are in the admin panel! Things should be easy from now on. Use the form Add a link to add links you wish to count clicks on and follow instructions.

Upgrading from CCount version 1.0

If you are upgrading from CCount version 1.0 note that the two databases ARE COMPATIBLE. This means you can keep all your old links! To upgrade from 1.0 to this version upload all files from this zip file over the old CCount files except clicks.txt and ids.txt! You should use your ODL clicks.txt and ids.txt files if you want to keep your existing links.

Good luck with the script!

>> Displaying number of clicks on a link

CCount from version 1.1 on allows you to display the number of clicks on a link at your website. To display number of clicks on your web page follow these two steps:

1. Add this code in your HTML document HEAD (paste it somewhere between <head> and </head> HTML tags):

<script language="Javascript" src="">

CHANGE to the URL of display.php on your server!

2. Add this code where you want the number of clicks to appear:

<script language="Javascript">ccount_display('LINK_ID')</script>

REPLACE LINK_ID with the ID number of the link you want to display the count for (IDs can be found when you login to CCount admin panel)! To display number of clicks on the link with ID 13 you would use this code:

<script language="Javascript">ccount_display('13')</script>

You may add any HTML tags around this code to format the count number. This code for example:

Link 9 has been clicked <font color="#FF0000"><script language="Javascript">ccount_display('9')</script></font> times

would produce such output:

Link 9 has been clicked 478 times

If you get an undefined error instead of a number please double-check the ID number you entered in the code above!

>> Troubleshooting

What is CHMOD and FTP?

I have prepared a simple FTP and CHMOD tutorial which will help you FTP files to your server and set correct CHMOD settings.

My counter doesn't work, HELP!

Ok, first of all don't panic, it's only a counter :-) Here are a few things to check:

  1. did you upload all files except images in ASCII mode?
  2. are clicks.txt and ids.txt files world writable? CHMOD them to 666 (rw-rw-rw) if you are on a UNIX server

Since these scripts are free no support is guaranteed. If you can't get the script to work please go through this readme file again carefully and repeat the installation step-by-step (also delete old files and folders from the server). Also please feel free to post any questions or problems you might have in PHPJunkyard forum!

>> Stay updated!

Join my FREE newsletter and you will be notified about new scripts, new versions of the existing scripts and other important news from PHPJunkYard.
Click here for more info

>> Please rate this script

If you like this script please rate it or even write a review at:

Rate this Script @ Hot Scripts

>> What else?

That's it! If you use PHPJunkYard free scripts or any portion of their code please place a link to on your website. I won't sue you if you don't, but I believe it is a fair trade for a free script/code. Think about it. You can find link suggestions here.

Best regards,

Klemen Stirn
PHP JunkYard