# CNStats STD/PRO 3.2 / User manual

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

# The list of config.php parameters

Settings stored in config.php:

## $STATS_CONF["cnsoftwaredomain"] (mandatory parameter)

    $STATS_CONF["cnsoftwaredomain"]="cnstats.com";

## $STATS_CONF["sqlserver"] (mandatory parameter)

SQL server software. So far only MySql is supported.

Example:

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

## $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["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["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"]="";

## $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["type"] (mandatory parameter)

Counter type.

- 0 - "GIF 1x1"
- 2 - "PHP-Include"
- 3 - "Combined" ("PHP-Include" + "GIFx1x1")

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

The value "1" is not used starting with the version 3.0.

## $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"

## $STATS_CONF["adminemail"]

Administrator's e-mail; it is used in the following cases:

- Recipient address of CNStats system errors notifications (provided that $COUNTER["senderrorsbymail"] option is enabled);
- Value of "Sender" and "Return address" fields in the reports send by e-mail.

Example:

    $STATS_CONF["adminemail"]="jonh@example.com"

## $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["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["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>.";

## $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:

- Combined;
- GIF 1x1;
- PNG 88x31.

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:

- header (by default) - Location HTTP-header is used for automatic redirections;
- meta - META-tags are used for automatic redirections; it is recommended in case IIS/5.0 server is used.

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["quiet"]

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

- Yes - the mode is enabled. It is recommended to use only in emergency cases, if SQL server is unstable;
- No (by default) - the mode is disabled.

Example:

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

## $STATS_CONF["codegeneration"]

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

- html (by default) - JavaScript code is generated and displayed;
- variable - JavaScript code is generated and recorded to $CNSTATS_JAVASCRIPT_CODE variable;
- onlyid - only request unique identifier is generated and recorded to $CNSTATS_JAVASCRIPT_CODE variable.

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";

    ?>

## $STATS_CONF["gdversion"]

The parameter sets GD library version:

- "0" - GD is not set;
- "1" - GD version 1.X is set;
- "2" - GD version 2.X is set;
- "auto" - Automatic definition of GD version (by default).

For example:

    $STATS_CONF["gdversion"]="auto";

## $STATS_CONF["code"]

Counter code format.

- "HTML" - HTML code;
- "XHTML" - XHTML code.

The parameter influences the counter code displayed at "Configuration - Counter code" section, as well as the code generated by the system upon using the combined counter type.

For example:

    $STATS_CONF["code"]="XHTML";

## $STATS_CONF["cnstats_http_path"]

The parameter works only in CNStats PRO.

Relative path to CNStats at your web-site. The path is defined automatically during CNStats installation. One can not change this setting after the installation.

For example:

    $STATS_CONF["cnstats_http_path"]="/cnstats/";

## Example of config.php

    <?php
    // License domain. It should match the register key domain.
    $STATS_CONF["cnsoftwaredomain"]="cnstats.com";

    // SQL server software. So far only MySql is supported.

    $STATS_CONF["sqlserver"]="MySql"

    // Name of the database, where CNStats stores all data. Names of
    // CNStats tables have $STATS_CONF["sqlprefix"] prefix, so it is
    // possible to use CNStats even if your hosting-provider granted
    // you access only to one database.

    $STATS_CONF["dbname"]="my_cnstats";

    // CNStats tables prefix

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

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

    $STATS_CONF["sqlhost"]="db12c.pair32.com";

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

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

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

    $STATS_CONF["sqlpassword"]="677conduge";

    // 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 the system performance, it slows down with larger database.
    // Database size can be monitored in the report "Database size".

    $COUNTER["savelog"]=60;

    // Counter type. (For more information, please, refer to
    // http://www.cnstats.com/en/support/manual/countercodehow.php
    //
    //   0 - Blank GIF image
    //   2 - PHP-include
    //   3 - Combined (PHP-include + GIF)

    $COUNTER["type"]=3;

    // 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.

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

    // 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.

    $COUNTER["disablepassword"]="no";

    // E-Mail address for the system errors notifications (provided that
    // $COUNTER["senderrorsbymail"] option is enabled).

    $STATS_CONF["adminemail"]="admin@cnstats.com";

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

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

    // 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.

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

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

    // $STATS_CONF["sqlinstructions"][]="";

    // 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).

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

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

    $STATS_CONF["slow_reports_time_limit"]="30";

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

    $STATS_CONF["hello string"]="";

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

    // $STATS_CONF["HTTPheaders"]["0"]="";

    // Template for pages exclusion from the statistics.

    // $STATS_CONF["excludeurl"][]="";

    // Automatic redirection type at the CNStats statistics interface.
    // Possible values:
    //    - header (by default) - Location HTTP-header is used for automatic
    //      redirections.
    //    - meta - META-tags are used for automatic redirections; it is
    //      recommended in case IIS/5.0 server is used.

    $STATS_CONF["redirect"]="meta";

    // SQL requests hiding mode; when it is activated, SQL error data are not
    // displayed.
    //   yes - the mode is enabled. It is recommended to use only in emergency
    //         cases, if SQL server is unstable;
    //   no (by default) - the mode is disabled.

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

    // Counter code generation mode (only for combined counter type).
    //    html (by default) - JavaScript code is generated and displayed;
    //    variable - JavaScript code is generated and recorded to
    //            variable;
    //    onlyid - only request unique identifier is generated and
    //           recorded to  variable.

    $STATS_CONF["codegeneration"]="html";

    // GD library version
    //    "0" - GD is not set
    //    "1" - GD version 1.X is set
    //    "2" - GD version 2.X is set
    //    "auto" - Automatic definition of GD version (by default)

    $STATS_CONF["gdversion"]="auto";

    // Counter code
    //    "HTML" - HTML friendly counter code
    //    "XHTML" - XHTML friendly counter code

    $STATS_CONF["code"]="HTML";

    // The catalogue, in which CNStats is installed.

    $STATS_CONF["cnstats_http_path"]="/cnstats/";
    ?>

Back | Manual index | Next