CNStats 2.8 / User manual

© "CN-Software" Ltd. 2002-2006
support@cn-software.com
www.cnstats.com, www.cn-software.com

The list of config.php parameters

Settings stored in config.php:


$STATS_CONF["dbname"] (mandatory parameter)

Name of the database, where CNStats stores all data. Names of CNStats tables have "cns_" prefix, so it is possible to use CNStats even if your hosting-provider supplied you with access to only one database.

Example:

$STATS_CONF["db_name"]="mysite_cnstats";

$STATS_CONF["sqlhost"] (mandatory parameter)

Database server address. As a rule, it is supplied by the hosting-provider.

Example:

$STATS_CONF["sqlhost"]="localhost";

$STATS_CONF["sqluser"] (mandatory parameter)

Database server login. You must have rights for creation and deletion of database tables for correct functioning of CNStats. These rights are usually supplied by the hosting-provider.

Example:

$STATS_CONF["sqluser"]="root";

$STATS_CONF["sqlpassword"] (mandatory parameter)

Database server password. It may be blank (often for "root" users). As a rule, it is supplied by the hosting-provider.

Example:

$STATS_CONF["sqlpassword"]="";

$STATS_CONF["adminpassword"] (mandatory parameter)

Password for statistics view. It is used with E-Mail set by the option $STATS_CONF["cnsoftwarelogin"])

The password is encrypted with MDS algorithm.

Example:

$STATS_CONF["adminpassword"]="ecb4cb24043cf723b4a5458da5f02";

Or, if you wish to change password used during installation:

$STATS_CONF["adminpassword"]=md5("mypassword");

$STATS_CONF["sqlserver"] (mandatory parameter)

SQL server software. So far only MySql is supported.

Example:

$STATS_CONF["sqlserver"]="MySql";

$STATS_CONF["cnsoftwarelogin"] (mandatory parameter)

E-Mail is used as login to view CNStats statistics. For the commercial versions this E-Mail should match the E-Mail the license is registered to. E-Mail and password ($STATS_CONF["cnsoftwarepassword"]) are transmitted to cnstats.com to get updated data files and extended reports.

Example:

$STATS_CONF["cnsoftwarelogin"]="admin@site.com";

If you decide to change E-Mail after purchase, you will have to change it for the current license in the license editing menu.


$STATS_CONF["cnsoftwarepassword"] (mandatory parameter for commercial version)

Password for the current license, which is used to get access to updates and extended reports. The password is not encrypted. After the purchase you will get an E-Mail with data to enter the Members Area. In your Member Area you will find the password for the current license. It should be inserted in this field.

Example:

$STATS_CONF["cnsoftwarepassword"]="mypassword";

The password may be changed in the license editing interface at www.cnstats.com. New password should be inserted into config.php afterwards.


$COUNTER["savelog"] (mandatory parameter)

It sets period of complete statistics storage per days. The longer the period, the more space is required for the database. The database size influences system performance, it slows down with larger database.

Database size may be monitored in the report "Database size".

Recommended value - 40.

Example:

$COUNTER["savelog"]=60;
You may increase database size any moment.

Note: Do not set too long period. 30-60 days is enough for most web-sites.

You may decrease database size any moment. Records are deleted at midnight.

Note: Some of your database settings may not allow decreasing database size. To decrease database size run sql table optimization by command: OPTIMIZE TABLE cns_log.


$COUNTER["domain"]

Address of the web-site main page where CNStats is installed. Ending slash ("/") is not used. The address is used to generate the counter code.

If the parameter is not set, it is built from the data generated in variable of the HTTP_HOST environment. If you use CNStats to count statistics for several domains and use combined counter, you should set this parameter, otherwise counter codes for secondary domains will be created incorrectly.

Example:

$COUNTER["domain"]="http://www.cnstats.com";

$COUNTER["type"] (mandatory parameter)

Counter type.

For more information, please, refer to "Counter types"


$COUNTER["inkR"], $COUNTER["inkG"], $COUNTER["inkB"]

Font color for symbols on the counter image. Each value may vary from 0 to 255.

Default color is black.

Example:

Black:

$COUNTER["inkR"]=0;
$COUNTER["inkG"]=0;
$COUNTER["inkB"]=0;

Red:

$COUNTER["inkR"]=255;
$COUNTER["inkG"]=0;
$COUNTER["inkB"]=0;

White:

$COUNTER["inkR"]=255;
$COUNTER["inkG"]=255;
$COUNTER["inkB"]=255;

$COUNTER["excludeip"], $COUNTER["excludemask"]

List of excluded IP addresses and networks. It is possible to set one or several ranges. It should be set in couples: IP-address first, than network mask.

Example:

For a single address:

$COUNTER["excludeip"]="127.0.0.1";
$COUNTER["excludemask"]="255.255.255.255";

For a single address and a single network:

$COUNTER["excludeip"][]="127.0.0.1";
$COUNTER["excludemask"][]="255.255.255.255";
$COUNTER["excludeip"][]="192.168.0.1";
$COUNTER["excludemask"][]="255.255.255.0";

$COUNTER["disablepassword"]

CNStats authorization disabling. "Yes" - authorization is disabled, "no" - authorization is enabled.

Sometimes it is more convenient to use "in-house" authorization when you install CNStats into existent software engine. In such cases you may switch off CNStats authorization to avoid double authorization.

Default value: "no"

Example:

$COUNTER["disablepassword"]="yes"

$COUNTER["senderrorsbymail"]

If it is set to "yes", then CNStats errors will be reported to the e-mail set in $STATS_CONF["cnsoftwarelogin"] parameter.

If "no", no errors reports will be send by e-mail.

Example:

$COUNTER["senderrorsbymail"]="yes";

$COUNTER["resolution"]

The parameter sets resolution of the statistics interface. It can be 800 or 1024 for 800x600 and 1024x768 correspondingly. Resolution affects size of tables as well as of charts.

Default value: 800

Example:

$COUNTER["resolution"]=800;

$COUNTER["sqlwritelog"]

Addition to the SQL request to write in the log-table. It is inserted in the SQL instruction in plain format between "INSERT" and the table name.

Note: Incorrect parameter can damage the database

Example:

$COUNTER["sqlwritelog"]="DELAYED";

$STATS_CONF["sqlinstructions"]

Array of SQL-instructions, performed upon connection to the database server. As a rule this option is used to configure localization, if the database server has incorrect settings.

Example:

$STATS_CONF["sqlinstructions"][]="SET NAMES cp1251";
$STATS_CONF["sqlinstructions"][]="SET CHARACTER SET cp1251";

$STATS_CONF["slow_reports_memory_limit"]

Memory volume limit for slow reports. There are two of them - "Entry pages" and "Trace browsing".

If integer is used, the value is measured in bytes. It is possible to use abbreviations - K (for kilobytes) and M (for megabytes).

Example:

$STATS_CONF["slow_reports_memory_limit"]="32M";

$STATS_CONF["slow_reports_time_limit"]

Time limit for slow reports (seconds). There are two of them - "Entry pages" and "Trace browsing".

Example:

$STATS_CONF["slow_reports_time_limit"]=1800;

$STATS_CONF["color"]

The parameter sets color template for the statistics interface. Nine colors which are used to display statistics are stored in array elements from 0 to 8 (from dark to light). 0 is for the darkest hue, 8 is for the lightest hue.

Default values:

$STATS_CONF["color"][0]="#489153";
$STATS_CONF["color"][1]="#88C591";
$STATS_CONF["color"][2]="#B8E1BD";
$STATS_CONF["color"][3]="#D4F3D7";
$STATS_CONF["color"][4]="#DAF5DE";
$STATS_CONF["color"][5]="#CFEDD3";
$STATS_CONF["color"][6]="#E7F9EA";
$STATS_CONF["color"][7]="#F2FCF4";
$STATS_CONF["color"][8]="#FEFEFE";

Example for the grey color:

$STATS_CONF["color"][0]="#606060";
$STATS_CONF["color"][1]="#808080";
$STATS_CONF["color"][2]="#C0C0C0";
$STATS_CONF["color"][3]="#D0D0D0";
$STATS_CONF["color"][4]="#E0E0E0";
$STATS_CONF["color"][5]="#F0F0F0";
$STATS_CONF["color"][6]="#E0E0E0";
$STATS_CONF["color"][7]="#F0F0F0";
$STATS_CONF["color"][8]="#FFFFFF";

$STATS_CONF["hello string"]

The parameter sets text string which is displayed in the login dialogue. HTML code may be used. The string is blank by default.

Example:

$STATS_CONF["hello string"]="To see the statistics
you should use login <B>guest</B> and
password <B>guest</B>.";

$STATS_CONF["guestlogin"]

The parameter sets guest login, which allows viewing statistics and using filters (creating, deleting). Other settings are not available for a guest.

For instance:

$STATS_CONF["guestlogin"]="guest";

$STATS_CONF["guestpassword"]

The parameter sets guest password. It is used together with $STATS_CONF["guestlogin"].

Guest logon allows viewing statistics and using filters (creating, deleting). Other settings are not available for a guest.

For instance:

$STATS_CONF["guestpassword"]="guest";

$COUNTER["timeoffset"] (this function is working in test mode)

Server time shift in seconds. It is set if the server, where your web-site is running, is located in the different time zone.

Example:

$COUNTER["timeoffset"]=-1800;

$COUNTER["HTTPheaders"]

Array of additional HTTP-headers, sent to the client in case the following counter types are used:

One can set additional Cookies, language, P3P data and other information passed through HTTP-headers with the help of this parameter.

Example:

$COUNTER["HTTPheaders"]["Language"]="ru";
$COUNTER["HTTPheaders"]["P3P"]="policyref=\"/w3c/p3p.xml\", CP=\"UNI\"";

$COUNTER["excludeurl"]

Template for pages exclusion from the statistics.

Example:

$COUNTER["excludeurl"][]="PHPSESSID";
$COUNTER["excludeurl"][]="favicon.ico";

Addresses, containing "PHPSESSID" and "favicon.ico" strings are excluded from statistics in this example.


$STATS_CONF["redirect"]

Automatic redirection type at the CNStats statistics interface. Possible values:

This option has been added because of incorrect Cookies processing during redirections made by IIS/5.0. For details, please, see Microsoft supporting server.


$STATS_CONF["sqlprefix"]

CNStats tables prefix; it is used when several CNStats copies are installed into one database. Default value is "cns_". Upon changing the prefix one should change names of all CNStats tables manually.

Example:

$STATS_CONF["sqlprefix"]="cns1_";

$STATS_CONF["quiet"]

SQL requests hiding mode; when it is activated, SQL error data are not displayed.

Example:

$STATS_CONF["quiet"]="no";

$STATS_CONF["codegeneration"]

Counter code generation mode (only for combined counter type).

With the help of "variable" value one can display PHP-part of a counter at one place, while JavaScript-part - at the other place. For instance:

<?php

include "config.php";

// Calling PHP-part of the counter code
include "/../cnstats/cnt.php";

// Displaying HTTP-header
header("Language: ".GetDocumentLanguage());

// Displaying top part of the document
include "top.php";

// Displaying JavaScript-part
print $CNSTATS_JAVASCRIPT_CODE;

// Displaying the body of the document
print DocumentBody();

// Displaying bottom part of the document
include "bottom.php";

?>

With the help of "onlyid" value you can change JavaScript-part of the counter code entirely and display it anywhere. For instance, you can use JavaScript-code, compatible with XHTML:

<?php

include "config.php";

// Calling PHP-part of the counter code
include "/../cnstats/cnt.php";

// Displaying HTTP-header
header("Language: ".GetDocumentLanguage());

// Displaying top part of the document
include "top.php";

?>

<a href="http://www.cnstats.com/" id="m">
<SCRIPT language="JavaScript" type="text/javascript">
cnsd=document;
cnsd.cookie='b=b';
cnsc=cnsd.cookie?1:0;
cnst=escape(cnsd.title);
cnst=cnst.replace(/\+/g,'%2B');
cnsa=navigator.appName;
cnsn=(cnsa.substring(0,2)=='Mi')?0:1;
cnss=screen;cnspx=(cnsn==0)?cnss.colorDepth:cnss.pixelDepth;
if (cnsd.getElementById)
{
    var i=cnsd.createElement('img');
    var iurl='/cnstats/cntc.php?i=<?php echo $CNSTATS_JAVASCRIPT_CODE;?>';
    iurl+='&c='+cnsc+'&e='+cnss.width+'.'+cnss.height+'&d='+cnspx;
    iurl+='&r='+escape(cnsd.referrer)+'&p='+escape(cnsd.location)+'&t='+cnst;
    i.src=iurl;
    i.width=1;i.height=1;i.border=0;
    cnsd.getElementById("m").appendChild(i);
}
</SCRIPT>
</a>

<?php

// Displaying the body of the document
print DocumentBody();

// Displaying bottom part of the document
include "bottom.php";

?>

Example of config.php

<?
// Data for the database server connection
$STATS_CONF["dbname"]="cnstats";
$STATS_CONF["sqlhost"]="localhost";
$STATS_CONF["sqluser"]="root";
$STATS_CONF["sqlpassword"]="";

$STATS_CONF["sqlserver"]="MySql";

// Password for administrative interface
$STATS_CONF["adminpassword"]="1cb4cb24043c45f74b8da5a523f02";

// E-Mail, to which the product is licensed to
// (it is also used to login to CNStats)
$STATS_CONF["cnsoftwarelogin"]="admin@site.com";

// Password, which is set in the license settings
$STATS_CONF["cnsoftwarepassword"]="mypassword";

// It saves full statistics for 30 days
$COUNTER["savelog"]=30;

// Web-site root directory without closing slash (/)
$COUNTER["domain"]="http://www.cnstats.com";

// Counter type - PHP-include
$COUNTER["type"]=1;

// PNG image font color
$COUNTER["inkR"]=0;
$COUNTER["inkG"]=255;
$COUNTER["inkB"]=0;

// Do not count my own visits 
$COUNTER["excludeip"][]="127.0.0.1";
$COUNTER["excludemask"][]="255.255.255.255";

// Do not disable CNStats authorization
$COUNTER["disablepassword"]="no";

// Report errors via E-Mail
$COUNTER["senderrorsbymail"]="yes";

// Adjust tables and diagrams for screen resolution 800x600
$COUNTER["resolution"]=800;

// Use grey colour spectrum
$STATS_CONF["color"][0]="#606060";
$STATS_CONF["color"][1]="#808080";
$STATS_CONF["color"][2]="#C0C0C0";
$STATS_CONF["color"][3]="#D0D0D0";
$STATS_CONF["color"][4]="#E0E0E0";
$STATS_CONF["color"][5]="#F0F0F0";
$STATS_CONF["color"][6]="#E0E0E0";
$STATS_CONF["color"][7]="#F0F0F0";
$STATS_CONF["color"][8]="#FFFFFF";

// Hello string 
$STATS_CONF["hello string"]="To see a demonstration, enter
<B>guest</B> for both the Login and Password fields.";

// Guest login
$STATS_CONF["guestlogin"]="guest"; 

// Guest passowrd
$STATS_CONF["guestpassword"]="guest"; 


// Use DELAYED INSERT when adding log to the table
$CONFIG["sqlwritelog"]="DELAYED";

// Resources limits
$STATS_CONF["slow_reports_memory_limit"]="32M";
$STATS_CONF["slow_reports_time_limit"]=1800;
?>

Back | Manual index | Next