Automatically Adding the Activation Code To Every PHP Page (Apache webservers only)
If you run an Apache server and are allowed to use .htaccess you can add code to existing .htaccess files, or create new .htaccess files. The commands in .htaccess files affect files in the same directory as the .htaccess and all subdirectories. Using the following commands, your webserver will add the BBClone activation code to *.php before parsing and sending them. (See next section for counting .htm or .html files.)
Create a file "count.php" to contain the BBClone activation code. Create this file and add the following:
<?php define("_BBCLONE_DIR", "/the/path/that/leads/to/bbclone/"); define("COUNTER", _BBCLONE_DIR."mark_page.php"); if (is_readable(COUNTER)) include_once(COUNTER); ?>
count.php
Highlighted in blue is the absolute server path to the BBClone directory. Relative paths are not allowed here. The absolute server path is how the server "sees itself", and does not refer to how someone might browse to the directory in the internet. Notice that the path uses the forward slash (/) and not the backslash (\). If you don't know the absolute path to your BBClone directory you can do the following:
Go to your bbclone directory, open index.php in your favorite editor and add these lines:
echo "<?php\n"
."define("_BBCLONE_DIR", ""
.dirname(__FILE__)."/");\n"
."define("COUNTER", _BBCLONE_DIR.""
."mark_page.php");\n"
."if (is_readable(COUNTER)) include_once(COUNTER);\n"
."?>\n";
determine your absolute path
Upload it to your webserver, point your browser to it, copy and paste the output and save it into a file as "count.php" (to stick with our example). Don't forget to remove the line from index.php afterwards else it will be displayed each time you call your stats.
Now add the following to your chosen .htaccess (to count all pages on your site, add to the .htaccess file above or in your www-root directory):
<FilesMatch "\.(php)$">
php_value short_open_tag "Off"
php_value auto_append_file "/the/path/that/leads/to/count.php"
</FilesMatch>
automatic .php counting
Note that if your BBClone directory is below this .htaccess file in the document tree, visits to the BBClone stats display pages will also be counted, since they are PHP files.
******************************************