11 réponses
asloulou
Messages postés
129
Date d'inscription
samedi 10 novembre 2007
Statut
Membre
Dernière intervention
20 mars 2012
88
5 sept. 2008 à 14:08
5 sept. 2008 à 14:08
salut,
inserer le code entre <body> et </body> sur toutes les pages que tu veut controler
inserer le code entre <body> et </body> sur toutes les pages que tu veut controler
asloulou
Messages postés
129
Date d'inscription
samedi 10 novembre 2007
Statut
Membre
Dernière intervention
20 mars 2012
88
5 sept. 2008 à 16:17
5 sept. 2008 à 16:17
phpmyvisite c'est bien la balise que te donne free que tu me parle????
asloulou
Messages postés
129
Date d'inscription
samedi 10 novembre 2007
Statut
Membre
Dernière intervention
20 mars 2012
88
5 sept. 2008 à 16:30
5 sept. 2008 à 16:30
moi je suis heberger cher free et il me donne acces a phpmyvisites et il mon donner ce code a inserer
<!--
var a_vars = Array();
var pagename='';
var phpmyvisitesSite =????????????;
var phpmyvisitesURL = "????????";
//-->
</script>
<script language="javascript" src="http://st.free.fr/phpmyvisites.js" type="text/javascript"></script>
<object><noscript><p>phpMyVisites | Open source web analytics
<img src="http://st.free.fr/phpmyvisites.php" alt="Statistics" style="border:0" />
</p></noscript></object></a>
<!-- /phpmyvisites --> <br><br>
voila
<!--
var a_vars = Array();
var pagename='';
var phpmyvisitesSite =????????????;
var phpmyvisitesURL = "????????";
//-->
</script>
<script language="javascript" src="http://st.free.fr/phpmyvisites.js" type="text/javascript"></script>
<object><noscript><p>phpMyVisites | Open source web analytics
<img src="http://st.free.fr/phpmyvisites.php" alt="Statistics" style="border:0" />
</p></noscript></object></a>
<!-- /phpmyvisites --> <br><br>
voila
asloulou
Messages postés
129
Date d'inscription
samedi 10 novembre 2007
Statut
Membre
Dernière intervention
20 mars 2012
88
5 sept. 2008 à 16:42
5 sept. 2008 à 16:42
tu est hebeger chez qui????
Vous n’avez pas trouvé la réponse que vous recherchez ?
Posez votre question
asloulou
Messages postés
129
Date d'inscription
samedi 10 novembre 2007
Statut
Membre
Dernière intervention
20 mars 2012
88
5 sept. 2008 à 22:54
5 sept. 2008 à 22:54
essaye de regarder si ton hebergeur te le propose ca sera plus simple sinon si c'est juste pour voir le nombre de visiteur va sur ce site http://www.123compteur.com/ je n'ai po eu de soucis avec eux
j'ai installé le code phpmyvisites entre les balises que vous m'avez conseillées mais je ne vois rien.Que faire?
sur le site j'ai téléchargé trois codes et je ne sais pas le code approprié
code1/<?php
/*
* phpMyVisites : website statistics and audience measurements
* Copyright (C) 2002 - 2006
* http://www.phpmyvisites.net/
* phpMyVisites is free software (license GNU/GPL)
* Authors : phpMyVisites team
*/
// $Id: config.inc.php 236 2007-11-04 15:04:08Z matthieu_ $
/**
* Maybe you want to edit these values (but be careful!)
*/
define('TIME_BEFORE_NEW_DAY_ARCHIVE', 10);//3600 * 3); // time before the current day is again archived when stats visited
define('INTERNAL_STATS', false); // define if phpmyvisites application statistics are saved
define('INTERNAL_CLICKHEAT', false); // define if phpmv app clicks are logged
define('SMARTY_DEBUG', false); // define if smarty is in debug mode (means CACHE activated, template build on each page, etc.)
define('DEFAULT_SITE', 1); // id of the site that is displayed after login (or -1 for summary)
define('CURRENT_DAY_SIMPLE_ARCHIVE', false); // define if current day archive is simplified or not
define('CURRENT_PERIOD_SIMPLE_ARCHIVE', false); // define if temp period archive is simplified or not
define('DEFAULT_DAY_TODAY', false); // is the default day today or yesterday?
define('ALL_POPULATION', false); // include all population or not
define('WEB_CRONTAB', true); // defines if the automatic crontab is activated or not (launched by the first visitor of each day). Must be desactivated if you setted a real crontab with the RSS feed (see FAQ)
define('SECURE_SERVER_HTTPS', false); // if true, the URLs constructed will be prefixed by https instead of http
define('COMPRESS_DB_DATA', true); // try to compress data before Database recording ? (can slow the process)
define('CATEGORY_DELIMITER', '/'); // category delimiter. Use '/' to make your categories automatically
define('TIME_TO_WAIT_FOR_PARALLEL_ARCHIVE', 40 * 60); // seconds to wait before try a new archive when a parallel archiving process is detected (also used in crontab task)
define('NB_IPS_RANGE_AVAILABLE', 10); // number of input for ip range exclude in the administration area
define('NB_URLS_ALIAS_AVAILABLE', 5); // number of input for urls alias in the administration area
define('NB_ELEMENTS_TO_DISPLAY', 10); // number of elements to display in tables (search engines, keywords, etc.)
define('DEFAULT_PAGE_NAME', 'index'); // default page name, when is like toto.com/ or toto.com/group1/group2/
define('PARAM_URL_PARTNER', 'pmv_pid'); // param name for identifying partner
define('PARAM_URL_NEWSLETTER', 'pmv_nid'); // param name for identifying newsletter
define('PREFIX_FILES', 'FILE:'); // prefix for files in the Javascript code Ex : pagename = 'FILE:group1/group2/group3/documentation.pdf'
define('PREFIX_ALL_TAG', 'FILE:'); // Liste of prefix for files,rss and pocast in the Javascript code Ex : pagename = 'FILE:group1/group2/group3/documentation.pdf'
define('MAX_DISTINCT_ELEMENTS', 300); // max elements (ex. number of keywords saved, number of distinct ISP)
define('MAX_DISTINCT_DETAILS_ELEMENTS', 300); // max distinct elements for details table (ex. number of keywords for a specific search engine)
define('MAX_DISTINCT_INTEREST_ELEMENTS', 150); // max elements used in Interest analysis
define('PMV_REWRITE_MODE', 'PEAR_REQUEST'); // [PEAR_REQUEST, URLREWRITE], PEAR_REQUEST : Use PEAR plugin with fsockopen (can be used if url is on the same server or if fsockopen is authorised with others servers), URLREWRITE (default) : rewrite url to the file
define('NEWSLETTER_FORCE_CREATE', false); // If phpmv recieve a call of a newsletter and if not exists : create the newsletter true ! error message : false
define('NEWSLETTER_CREATE_NAME', 'Newsletter : '); // Begining of the name when you force newsletter creation
define('NEWSLETTER_ID_MAX_AUTO', 100); // Max newsletter id create automatically (-1 no limit)
/**
* You shouldn't edit the values after this comment
*/
define('CACHE_SMARTY', 60*60*48); // define smarty cache lifetime
define('DEFAULT_TIME_PAGE', 20); // 20 sec per page if there isn't any page following (time standard!)
define('TIME_SLOW_QUERY', 0.05); // slow queries are loggued into database
define('PERCENT_MAX', 1000); // percent maximum born
define('THEME_DEFAULT', 'default'); // default theme directory
define('THEME_ADMIN', 'default'); // admin theme directory
define('STORE_PAG_ARRAY_IN_FILE', false); // store big page arrays in files. Increase performance for stat report, but uses disk space
define('NB_DAYS_FOR_RSS_ITEMS', 3); // days to compute to syndicate in the RSS sites (to multiply by number of sites ! be careful !)
define('ADMINISTRATOR_MAIL', 'phpmyvisites@gmail.com'); // mail that appears in the mail sent from phpmyvisites
define('CACHE_RSS_LIFETIME', 3600); // lifetime of the rss syndication file cache
define('CACHE_MAIL_LIFETIME', 3600); // lifetime of the mail file cache
define('PHP_VERSION_NEEDED', '4.3'); // version of php needed for phpmyvisites to work correctly
define('MEMORY_LIMIT', 16); // good value for memory limit
define('DEFAULT_MODULE', 'view_visits'); // name of the default module loaded
define('COOKIE_PMVLOG_NAME', 'pmv_ck_'); // cookie name for log
define('COOKIE_NAME_VIEW', 'pmv_ck_view_conf'); // cookie name for stats view
define('COOKIE_NAME_SESSION', 'pmv_ck_session'); // cookie name for session
define('COOKIE_NAME_NO_STAT', 'pmv_ck_no_stat'); // cookie name for session
define('MAX_LENGTH_ONE_VALUE_IN_COOKIE', 300); // length in byte
define('TIME_ONE_VISIT', 30*60); // time max for one visit (the time is normed) in seconds
define('MAX_LENGTH_JAVASCRIPT_A_VARS_ARRAY', 200); // max length for a variable value in the "var a_vars" javascript array in javascript code
define('COOKIE_EXPIRE', 86400*365*10); // time after which the cookie will expire
define('SECURE_TIME_BEFORE_NEW_ARCHIVE', 20); // time added to each archive's valid time for current day archives. It is a security to try to use the same archives for the graphs on the page
// For PHPMV_STAT_*, INTERNAL_STATS must be set to true
define('PMV_STAT_ID_SITE', 1); // Id of site where phpmv site must be saved (-1) : So create a site in phpmyvistes and set here, the id of this site
define('PMV_STAT_SAVE_USER', true); // true to have login name in variable of page viewed
// Other
if(!defined('DEBUG')) define('DEBUG', false);
define('DEFAULT_ACTION', false);
error_reporting( E_ALL );
if(DEBUG)
{
define('PRINT_TIME', false);
define('PRINT_QUERY_COUNT', true);
define('SAVE_DB_LOG', true);
define('PRINT_QUERY', true);
}
else
{
define('PRINT_QUERY', false);
define('PRINT_TIME', false);
define('PRINT_QUERY_COUNT', false);
define('SAVE_DB_LOG', false);
}
// relative directories
define('DIR_IMG_THEMES', './themes/'.THEME_DEFAULT.'/images/');
define('DIR_IMG_BROWSERS', './images/browsers');
define('DIR_IMG_OS', './images/os');
define('DIR_IMG_PLUGINS', './images/plugins');
define('DIR_IMG_LOGOS', './images/logos');
define('DIR_IMG_COUNTRIES_FLAGS', './images/countries_flags');
define('DIR_IMG_SCREENS', './images/screens');
define('DIR_IMG_SEARCH_ENGINES', './images/search_engines');
// absolute directories
define('LANGS_PATH', INCLUDE_PATH . '/langs');
define('DIR_IMG_MAPS', INCLUDE_PATH . '/images/maps');
define('DIR_CACHE_RSS', INCLUDE_PATH . '/datas/cache_lite/');
define('DIR_CACHE_MAIL', INCLUDE_PATH . '/datas/cache_lite/');
define('FONTS_PATH', INCLUDE_PATH . '/libs/artichow/font/');
// xhtml
define('HREF_DOC_OPEN', "<strong><a href='http://www.phpmyvisites.us/documentation/'>");
define('HREF_DOC_CLOSE', "</a></strong>");
define('HREF_FORUMS', "<strong><a href=\"http://www.phpmyvisites.us/forums/\" alt=\"{'head_titre'|translate}\" title=\"{'head_titre'|translate}\">http://www.phpmyvisites.us/forums/</a></strong>");
define('URL_SITE_EXAMPLE', 'http://www.site.com');
define('IP_EXAMPLE', 'A.B.C.D or A.B.C.x...');
define('GET_LIST_EXAMPLE', '<i>id;data;page</i>');
// archiving
define('REF_TYPE_SEARCH_ENGINE', 1);
define('REF_TYPE_SITE', 2);
define('REF_TYPE_PARTNER', 3);
define('REF_TYPE_NEWSLETTER', 4);
define('REF_TYPE_DIRECT_ENTRY', 5);
define('DB_ARCHIVES_PERIOD_DAY', 1);
define('DB_ARCHIVES_PERIOD_WEEK', 2);
define('DB_ARCHIVES_PERIOD_MONTH', 3);
define('DB_ARCHIVES_PERIOD_YEAR', 4);
define('DB_ARCHIVES_PERIOD_MISC_PERIOD', 5);
define('DB_ARCHIVES_DONE', 1);
define('DB_ARCHIVES_TEMP', 2);
define('DB_ARCHIVES_FAIL', 3);
define('ARRAY_INDEX_COUNT', 1);
define('ARRAY_INDEX_PAGE_NAME', 2);
define('ARRAY_INDEX_IDPAGE', 3);
define('ARRAY_INDEX_IDCATEGORY', 4);
define('ARRAY_INDEX_LEVEL', 5);
define('ARRAY_INDEX_IDPARENT', 6);
define('ARRAY_INDEX_TIME_TOTAL' , 7);
define('ARRAY_INDEX_ENTRYPAGE', 8);
define('ARRAY_INDEX_EXITPAGE', 9);
define('ARRAY_INDEX_VARS', 10);
define('ARRAY_INDEX_TYPE', 11);
define('ARRAY_INDEX_PAGES_VISIT_ONEPAGE', 12);
define('ARRAY_INDEX_PAGES_COUNT', 13);
define('ARRAY_INDEX_RETURNING_COUNT', 14);
define('ARRAY_INDEX_NEW_COUNT', 15);
define('ARRAY_INDEX_VAR_COUNT', 1);
define('ARRAY_INDEX_VAR_VALUE', 2);
define('ARRAY_TYPE_PAGE', 1);
define('ARRAY_TYPE_FILE', 2);
define('STAT_PAGE_PER_VISIT', 0);
define('STAT_PAGE_PER_VISIT_SIGNIFICANT', 1);
define('STAT_ONE_PAGE_RATE', 2);
define('STAT_TIME_PER_VISIT', 3);
define('DATE_NORMAL', 0);
define('DATE_GRAPH', 1);
define('DATE_GRAPH_LONG_AXIS', 2);
// Require
require_once INCLUDE_PATH."/version.php";
require_once INCLUDE_PATH."/core/datas/browserFamilies.php";
require_once INCLUDE_PATH."/core/datas/browsers.php";
require_once INCLUDE_PATH."/core/datas/countryList.php";
require_once INCLUDE_PATH."/core/datas/ispCountryList.php";
require_once INCLUDE_PATH."/core/datas/osLists.php";
require_once INCLUDE_PATH."/core/datas/pagesGap.php";
require_once INCLUDE_PATH."/core/datas/searchEngines.php";
require_once INCLUDE_PATH."/core/datas/timeGap.php";
require_once INCLUDE_PATH."/core/datas/fontList.php";
/**
* Simple function to replicate PHP 5 behaviour
*/
function getMicrotime()
{
list($usec, $sec) = explode(" ", microtime());
return ((float)$usec + (float)$sec);
}
$GLOBALS['time_start'] = getMicrotime();
$GLOBALS['query_count'] = 0; // number of queries of the page
$GLOBALS['a_content'] = array(); // cookie content
$GLOBALS['header_message_tpl'] = '';
$GLOBALS['header_error_message_tpl'] = '';
?>
Code2<?php
/*
* phpMyVisites : website statistics and audience measurements
* Copyright (C) 2002 - 2006
* http://www.phpmyvisites.net/
* phpMyVisites is free software (license GNU/GPL)
* Authors : phpMyVisites team
*/
// $Id: index.php 220 2007-06-27 10:01:07Z matthieu_ $
define('INCLUDE_PATH', '.');
define('PLUGINS_PATH', INCLUDE_PATH."/plugins/");
// For profiling, XDEBUG 2.x generates .out to be analysed with KcacheGrind or WinCacheGrind
@set_time_limit(0);
@error_reporting(E_ALL);
require_once INCLUDE_PATH . '/core/include/PmvConfig.class.php';
require_once INCLUDE_PATH . '/core/include/ApplicationController.php';
ApplicationController::init();
if( Request::moduleIsNotAStrangeModule() )
printTime('EOF', PRINT_TIME);
Code 3
<?php
/*
* phpMyVisites : website statistics and audience measurements
* Copyright (C) 2002 - 2006
* http://www.phpmyvisites.net/
* phpMyVisites is free software (license GNU/GPL)
* Authors : phpMyVisites team
*/
// $Id: phpmyvisites.php 218 2007-06-02 07:15:48Z cmil $
define('SAVE_STAT', true ); // default true
define('LOOK_FOR_COOKIE', true); // default true
define('DEBUG', false); // default false
define('TRACE_IN_FILES', false); // default false
define('INCLUDE_PATH', '.');
define('PRINT_COOKIE_CONTENT', false); // debug only : display cookie content for the current domain
define('PRINT_ALL_COOKIES_CONTENT', false); // debug only : display all pmv cookies for the current domain
// TODO dans le test du referer appartient au site, testez également en plus
// des sitesUrls le host de l'url de la page current sur le host de l'url ref
@ignore_user_abort(true);
@set_time_limit(0);
@error_reporting(E_ALL);
require_once INCLUDE_PATH."/core/include/Lang.class.php";
require_once INCLUDE_PATH.'/config.inc.php';
require_once INCLUDE_PATH."/core/include/Logs.functions.php";
require_once INCLUDE_PATH."/core/include/common.functions.php";
require_once INCLUDE_PATH."/core/include/Cookie.class.php";
require_once INCLUDE_PATH."/core/include/Site.class.php";
require_once INCLUDE_PATH."/core/include/PmvConfig.class.php";
if(!SAVE_STAT)
{
redirectToUrlIfNecessary();
// else, display pixel
$img = INCLUDE_PATH . "/images/logos/pixel.gif";
header("Content-type: image/gif");
readfile($img);
exit;
}
// hack for not to show tables (because getCurrentCompleteUrl bugs
// with url containing another url in one parameter)
$GLOBALS['currentModuleIsLogModule'] = true;
$c =& PmvConfig::getInstance();
$db =& Db::getInstance();
$db->connect();
// when no get specified, display a marketing page :)
if(sizeof($_GET) === 0)
{
require_once INCLUDE_PATH."/core/include/Lang.class.php";
$l =& Lang::getInstance();;
displayPageWhenEmptyGet();
exit;
}
if(DEBUG)
{
require_once INCLUDE_PATH."/core/include/functions.php";
}
if(DEBUG)
ob_start();
// - imprimer doc mysql "optimisation"
/*
* Get page & visitor information
*/
$idSite = getRequestVar('id', null, 'numeric');
$GLOBALS['cookie'] = new Cookie( COOKIE_PMVLOG_NAME . $idSite);
if(LOOK_FOR_COOKIE && $GLOBALS['cookie']->isDefined())
{
printDebug("<b>Cookie at the beginning (size : ".$GLOBALS['cookie']->getSize()." bytes)</b> :<br>");
printDebug($GLOBALS['cookie']->get());
$returningVisitor = 1;
}
else
{
$returningVisitor = 0;
printDebug("<b>Cookie not found !</b><br><br>");
}
$flash = getRequestVar('flash', 0, 'numeric');
$director = getRequestVar('director', 0, 'numeric');
$quicktime = getRequestVar('quicktime', 0, 'numeric');
$realPlayer = getRequestVar('realplayer', 0, 'numeric');
$windowsMedia = getRequestVar('windowsmedia', 0, 'numeric');
$cookieAccept = getRequestVar('cookie', 0, 'numeric'); // Don't name $cookie because conflict with $GLOBALS['cookie']
$pdf = getRequestVar('pdf', 0, 'numeric');
$java = getRequestVar('java', -1, 'numeric');
if ($java == -1) {
$javascript = 0;
$java = 0;
}
else {
$javascript = 1;
}
$refererUrl = getRequestVar('ref', '');
$typeTag = getRequestVar('type', "", 'string');
$site = new Site($idSite);
// debug cookie
if(PRINT_ALL_COOKIES_CONTENT)
{
require_once INCLUDE_PATH . "/core/include/DataModel.class.php";
$sitesId = $site->getSitesId();
foreach($sitesId as $sid)
{
$c = new Cookie( COOKIE_PMVLOG_NAME . $sid);
print($c->toString());
}
exit;
}
else if(PRINT_COOKIE_CONTENT)
{
print($GLOBALS['cookie']->toString());
exit;
}
/*
* site urls
*/
// commented in 2.3b3 because its actually not used
//if(!$siteUrls = $GLOBALS['cookie']->getVar('site_urls'))
//{
// $siteUrlsBefore = $site->getUrls();
// $siteUrls = array();
// if(is_array($siteUrlsBefore))
// {
// foreach($siteUrlsBefore as $url)
// {
// $url = trim($url);
// if( array_search( $url, $siteUrls) === false
// && !empty($url) )
// {
// $siteUrls[] = $url;
// }
// }
// }
// // save array of site urls in the cookie
// $GLOBALS['cookie']->setVar('site_urls', $siteUrls);
//}
/*
* site info
*/
//if(!$siteInfo = $GLOBALS['cookie']->getVar('site_info'))
//{
// $siteInfo = $site->getInfo();
//
// // save array of site urls in the cookie
// $GLOBALS['cookie']->setVar('site_info', $siteInfo);
//}
$logo = $site->getLogo();
$siteParams = $site->getParams();
$pageUrl = getRequestVar('url', '', 'string');
if ($pageUrl == "") {
// May be it is a bot !!
printDebug("No url : may be it's a bot ! So we don't save this visit !");
redirectToUrlIfNecessary();
loadImage($logo, $idSite);
exit();
}
// After modif js where we remove all before // in url
// We add http: to not have error in parse_url
if (substr($pageUrl, 0, 2) == "//") {
$pageUrl = "http:".$pageUrl;
}
/*
// Verify that url is in your site
$trouve = false;
foreach($siteUrls as $url)
{
$posInUrl = strpos($pageUrl, $url);
$trouve = ($posInUrl == 0);
}
if (! $trouve) {
printDebug("Url is not ok !");
redirectToUrlIfNecessary();
loadImage($logo, $idSite);
exit();
}
*/
/**
* exit if visitor is cookie excluded from the stats
*/
if(isset($_COOKIE[COOKIE_NAME_NO_STAT.$site->getId()]))
{
printDebug("Excluded from stats with the cookie!");
redirectToUrlIfNecessary();
loadImage($logo, $idSite);
}
/*
* page variables
*/
$a_vars = getRequestVar('a_vars', array(), 'array');
/*
* visitor config, as saved in the database
*/
$userAgent = secureVar(@$_SERVER['HTTP_USER_AGENT']);
$os = getOs($userAgent);
$a_browser = getBrowserInfo($userAgent);
$resolution = getRequestVar('res', 'unknown', 'string');
$colorDepth = getRequestVar('col', 32, 'numeric');
$browserLang = secureVar(@$_SERVER['HTTP_ACCEPT_LANGUAGE']);
$localTime = getRequestVar('h',date("H"),'numeric').':'.
getRequestVar('m',date("i"),'numeric').':'.getRequestVar('s',date("s"),'numeric');
// assign pageCategory default value of the parse_url::path?query
$pageUrlParamsProcessed = processParams($pageUrl, $siteParams);
// fix add site.com because else parse_url bugs with ':' in query string
if(!ereg('^http://',$pageUrlParamsProcessed))
{
$urlParse = parse_url('http://site.com'.$pageUrlParamsProcessed);
}
else
{
$urlParse = parse_url($pageUrlParamsProcessed);
}
if(isset($urlParse['path']))
{
$pageNameDefault = substr($urlParse['path'], 1);
}
if(isset($urlParse['query']))
{
$pageNameDefault .= '?'.$urlParse['query'];
}
if( (!isset($pageNameDefault)
|| strcmp($pageNameDefault, '')===0)
&& isset($urlParse['host'])
)
{
$pageNameDefault = DEFAULT_PAGE_NAME;
}
else if(!isset($pageNameDefault))
{
$pageNameDefault = null;
}
printDebug("PageNameDefault : " . $pageNameDefault);
// stripslashed because otherwise pageName if value is pageNameDefault is slashed twice
$pageCompleteName = utf8_encode(getRequestVar('pagename' ,
stripslashes(html_entity_decode($pageNameDefault))
)
);
$pageCompleteName = str_replace(array("\n", "\r"), '', $pageCompleteName);
$pageCompleteName = str_replace(array("?"), '', $pageCompleteName);
if ($typeTag != "") {
$pageCompleteName = $typeTag.":".$pageCompleteName;
}
// works only on 'path' of this url because the query may contain delimiter !
$file = '';
//if(substr($pageCompleteName, 0, 5) === PREFIX_FILES)
if(isPrefixTag ($pageCompleteName))
{
// $file = PREFIX_FILES;
$file = getPrefixTag($pageCompleteName);
}
printDebug("<br>Page complete name:".$pageCompleteName);
$urlParse = parse_url('http://site.com/'.$pageCompleteName);
$pageCompleteNamePath = substr($urlParse['path'],1);
$lastDelimiter = strrpos($pageCompleteNamePath, CATEGORY_DELIMITER);
printDebug("<br>Page name complete path:".$pageCompleteNamePath);
printDebug("<br>Pos last delimiter : $lastDelimiter");
if($lastDelimiter !== false)
{
// in the $pageCompleteName "g1>g2>page" select only "g1>g2"
$pageCategory = substr($pageCompleteNamePath, 0, $lastDelimiter);
// $pageCategory = str_replace( PREFIX_FILES, '', $pageCategory);
$tabTag = split(",", PREFIX_ALL_TAG);
foreach ($tabTag as $info) {
$pageCategory = str_replace($info, '', $pageCategory);
}
if($pageCategory == '/'
|| $pageCategory == ' '
|| $pageCategory == '+'
|| $pageCategory == '-'
|| $pageCategory == '"'
|| $pageCategory == '\''
)
{
$pageCategory = '';
}
// in the $pageCompleteName "g1>g2>page" select only "page"
// if pageCompleteNamePath bug when all variables recorded, no pagename, only save index.php
$pageName = $file . substr($pageCompleteName, $lastDelimiter + 1);
}
else
{
$pageCategory = '';
$pageName = $pageCompleteName;
}
//var_dump($pageCategory);exit;
// concerning names of pages in subgroups like /g1/g2/g3/ without page names
if(strcmp($pageName, '')===0)
{
$pageName = DEFAULT_PAGE_NAME;
}
printDebug('<br>URL : '.$pageUrl);
printDebug('<br>typeTag : '.$typeTag);
printDebug('<br>pageName : '.$pageName);
printDebug('<br>pageCategory : '.$pageCategory);
printDebug('<br>a_vars : '); printDebug($a_vars);
printDebug('<br>referer : '); printDebug($refererUrl);
printDebug('<br>flash : '.$flash);
printDebug('<br>director : '.$director);
printDebug('<br>quicktime : '.$quicktime);
printDebug('<br>real player : '.$realPlayer);
printDebug('<br>windows media : '.$windowsMedia);
printDebug('<br>cookie : '.$cookieAccept);
printDebug('<br>PDF : '.$pdf);
printDebug('<br>java : '.$java);
printDebug('<br>javascript : '.$javascript);
printDebug('<br>referer Url : '.$refererUrl);
printDebug('<br>id site : '.$idSite);
//printDebug('<br>site Urls : '); printDebug($siteUrls);
//printDebug('<br>site Info : '); printDebug($siteInfo);
printDebug('<br>user Agent : '.$userAgent);
printDebug('<br>os : '.$os);
printDebug('<br>browser : '.$a_browser['longName']);
printDebug('<br>resolution : '.$resolution);
printDebug('<br>color : '.$colorDepth);
/**
* other information
*/
$todayDate = date("Y-m-d");
/**
* try to recognize the visitor, with or without cookie
* who said we are very strong ?
*/
// last_visit = last visit timestamp
// idcookie = id cookie
printDebug("<br><strong>Try to recognize the visitor...</strong><br>");
function saveCountInFile( $fileName )
{
$count = 0;
$fileName = './count/'.$fileName;
if(is_file($fileName))
{
include($fileName);
if(isset($count) && is_integer($count) && $count != 0)
{
saveConfigFile( $fileName, $count+1, "count");
}
}
}
if(TRACE_IN_FILES) saveCountInFile( 'p_total' );
$timeDiffRef = DEFAULT_TIME_PAGE;
// does phpmyvisites cookie exist ?
if($GLOBALS['cookie']->isDefined())
{
// yes, known visitor
$idVisit = $GLOBALS['cookie']->getVar('idvisit');
$idCookie = $GLOBALS['cookie']->getVar('idcookie');
$lastVisit = $GLOBALS['cookie']->getVar('last_visit_time');
$serverTime = $GLOBALS['cookie']->getVar('server_time');
$serverDate = $GLOBALS['cookie']->getVar('server_date');
$idPageRef = $GLOBALS['cookie']->getVar('idpage_ref');
if(TRACE_IN_FILES) saveCountInFile( 'p_cookie' );
if(DEBUG)
printDebug("<br>We know the visitor (thanks to his cookie).
<br>He has idvisit = $idVisit and went last time on
".getTimeForDisplay($lastVisit)."<br>");
}
else
{
printDebug("=>We can't find the cookie...<br>");
if(TRACE_IN_FILES) saveCountInFile( 'p_non_cookie' );
// compute IP
$ip = getIp();
$ip2long = ip2long($ip);
exitIfIpExcluded($ip2long, $logo, $site);
$serverDate = $todayDate;
$tryPutCookie = true;
//edit 2.2RC3 now we check all the time, because if someone refresh the home page 100 times
// and didn't accept cookies, it was counted 100 visitors!!
/*
if($site->isUrlIn($refererUrl))
{
printDebug("=> Referer Is in the site ! try to catch the visitor...<br>");
if(TRACE_IN_FILES) saveCountInFile( 'p_ref_url_in' );
}
*/
$md5Config = md5( $os . serialize($a_browser) . $resolution . $colorDepth . $pdf
. $flash . $java . $javascript . $director . $quicktime . $realPlayer . $windowsMedia . $cookieAccept
. $ip2long . $browserLang);
// does the config (os+browser+resolution+color_depth) and the IP match any visitor ?
$r = query("SELECT idvisit, idcookie, TIME_TO_SEC(last_visit_time),
TIME_TO_SEC(server_time), exit_idpage
FROM ".T_VISIT."
WHERE server_date = '$todayDate'
AND idsite = '$idSite'
AND md5config = '$md5Config'
ORDER BY last_visit_time DESC
LIMIT 1");
if(mysql_num_rows($r)>0)
{
// yes
$r = mysql_fetch_row($r);
$idVisit = $r[0];
$idCookie = $r[1];
$lastVisit = $r[2];
$serverTime = $r[3];
$idPageRef = $r[4];
if(TRACE_IN_FILES) saveCountInFile( 'p_ref_url_in_found' );
printDebug("=> We found the MD5CONFIG of visitor so he is known<br>");
}
// case we didn't match any visitor
if(!isset($idVisit))
{
// no, new visitor
$newVisitor = true;
if(TRACE_IN_FILES) saveCountInFile( 'p_ref_not_found' );
printDebug("=> It's definitely a new visitor<br>");
}
}
if(isset($lastVisit)
&& $lastVisit !== false
&& $lastVisit < todayTime() // case the lastVisit value has been spoiled
)
{
$timeDiffRef = todayTime() - $lastVisit;
// case the lastVisit value has been spoiled (BIS)
$timeDiffRef = min($timeDiffRef, TIME_ONE_VISIT);
}
if(!isset($idPageRef)
|| $idPageRef === false )
{
$idPageRef = 0;
}
else
{
printDebug("We know its page ref id=$idPageRef and he stayed on it $timeDiffRef seconds <br>");
}
/**
* Current visitor is a new visitor or an old one
* but without cookie, so we put a cookie
*/
if(isset($newVisitor) || isset($tryPutCookie))
{
// record it and set the cookie
$idCookie = $GLOBALS['cookie']->put(isset($idCookie)?$idCookie:'');
// case : visitor known but cookie not set during his first page views...
if(isset($idVisit))
{
$GLOBALS['cookie']->setVar('idvisit', $idVisit);
}
else
{
$lastVisit = todayTime();
}
}
/**
* Visitor is known, we now look if it's a new visit or not
*/
// is the visit older than 30 minutes ?
if(!isset($newVisitor))
{
if(DEBUG)
printDebug("(idvisit = $idVisit, ".getTimeForDisplay($serverTime)." | now : " .
todayTime()." :: first page last time : $serverTime)");
if ($serverDate == date("Y-m-d")
&& ($lastVisit > (todayTime() - TIME_ONE_VISIT))
)
{
// yes, new visit
$GLOBALS['cookie']->setVar('last_visit_time', todayTime());
$knownVisit = true;
printDebug("<br><b>=>Visit is known on date : $serverDate</b><br>");
}
else
{
printDebug("=>Last visit is too old <b>==> New visit</b><br>");
$returningVisitor = 1;
}
}
else
{
printDebug("<br><b>=>New Visitor also means new visit</b><br>");
}
/**
* Current visit is a known visit
*/
// save current page, etc.
if(isset($knownVisit) && $knownVisit)
{
// we know
// * $lastVisit
// * $idVisit
// * $idCookie
// update last_visit_time
printDebug("==> This is a visit known... we update the data <br>");
// do it first because we need idpage for visit info insert
//print("$pageName <br> $pageUrl <br> $pageCategory ");exit;
$a_idPages = recordDbPage($pageName, $pageUrlParamsProcessed, $pageCategory, false);
$idPage = $a_idPages[0];
// save current page & url & variables information
$idLink_vp = recordDbInfoPage($idVisit, $idPage, $idPageRef, $timeDiffRef, $a_vars);
$total_time = DEFAULT_TIME_PAGE + todayTime() - $serverTime;
// update last_visit_time & total_pages & c_total_time
$r = query("UPDATE ".T_VISIT."
SET last_visit_time = CURRENT_TIME(),
total_pages = total_pages + 1,
total_time = '$total_time',
exit_idpage = '$idPage'
WHERE idvisit = '$idVisit'
LIMIT 1");
}
/*
* Current visit a new visit
*/
// now we know the visitor and its idcookie
// save new visit
else
{
printDebug("==> This is a new visit, we create datas in the database when necessary<br>");
if(!isset($ip) || !isset($ip2long))
{
$ip = getIp();
$ip2long = ip2long($ip);
exitIfIpExcluded($ip2long, $logo, $site);
}
$hostExt = getHostnameExt(getHost($ip));
printDebug('<br>ip : '.$ip);
printDebug('<br>hostname : '.$hostExt);
$serverDate = date("Y-m-d");
$serverTime = date("H:i:s");
$country = getCountry($hostExt, $browserLang);
if($country == 'gb')
{
$country = 'uk';
}
$continent = getContinent($country);
if(strlen($refererUrl)===0)
{
$refererUrl = 'NULL';
}
else
{
$refererUrl = "'".$refererUrl."'";
}
// do it first because we need idpage for visit info insert
$a_idPages = recordDbPage($pageName, $pageUrlParamsProcessed, $pageCategory, true);
$idPageUrl = $a_idPages[1];
$idPage = $a_idPages[0];
$md5Config = md5( $os . serialize($a_browser) . $resolution . $colorDepth . $pdf
. $flash . $java . $javascript . $director . $quicktime . $realPlayer . $windowsMedia . $cookieAccept
. $ip2long . $browserLang);
// save visitor information
$r = query("INSERT INTO ".T_VISIT."
(idsite, idcookie, returning, last_visit_time, server_date, server_time, md5config,
referer, os, browser_name, browser_version, resolution, color_depth,
pdf, flash, java, javascript, director, quicktime, realplayer, windowsmedia, cookie,
local_time, ip, hostname_ext, browser_lang, country, continent,
total_pages, total_time, entry_idpage, entry_idpageurl, exit_idpage)
VALUES ('$idSite', '$idCookie', '$returningVisitor', CURRENT_TIME(),
'$serverDate', '$serverTime', '$md5Config',
$refererUrl, '$os', '".$a_browser['shortName']."',
'".$a_browser['version']."', '$resolution', '$colorDepth',
'$pdf', '$flash','$java', '$javascript', '$director', '$quicktime', '$realPlayer', '$windowsMedia', '$cookieAccept',
'$localTime','$ip2long', '$hostExt', '$browserLang', '$country', '$continent',
1, '".DEFAULT_TIME_PAGE ."', '$idPage', '$idPageUrl', '$idPage')
");
$idVisit = mysql_insert_id();
// save page view and URL and variables
recordDbInfoPage($idVisit, $idPage, $idPageRef, $timeDiffRef, $a_vars);
// save idvisit
$GLOBALS['cookie']->setVar('idvisit', $idVisit);
$GLOBALS['cookie']->setVar('last_visit_time', todayTime());
$GLOBALS['cookie']->setVar('server_time', todayTime());
$GLOBALS['cookie']->setVar('server_date', $serverDate);
}
$GLOBALS['cookie']->setVar('idpage_ref', $idPage);
$GLOBALS['cookie']->save();
printDebug("<br><b>Next cookie should be :</b>");
printDebug($GLOBALS['cookie']->getContent());
// footer
if(PRINT_QUERY_COUNT)
printQueryCount();
if(PRINT_TIME)
printTime();
if(SAVE_DB_LOG)
{
recordDbQueryCount($idSite);
}
require_once INCLUDE_PATH . "/core/include/common.functions.php";
$crontabFile = INCLUDE_PATH . "/config/crontab.php";
if(is_file($crontabFile))
{
include($crontabFile);
}
if( WEB_CRONTAB
&& is_writable( $crontabFile)
&&
(
// if crontab doesn't exist in the file or the file doesn't exist
// or if the last try was before today
( !isset($crontab)
|| $crontab['date_last_success'] != getDateFromTimestamp(time())
)
&&
(
!is_file($crontabFile)
|| ( isset($crontab)
&& $crontab['time_last_try'] < time() - TIME_TO_WAIT_FOR_PARALLEL_ARCHIVE // every 5min
)
)
)
)
{
$crontab['time_last_try'] = time();
$crontab['date_last_success'] = '2000-12-31';
saveConfigFile( $crontabFile, $crontab, "crontab");
printDebug('==========================<br>
CRONTAB BEGIN/ <br>
==========================<br>
');
require_once INCLUDE_PATH . '/core/include/PmvConfig.class.php';
require_once INCLUDE_PATH . '/core/include/ApplicationController.php';
$r =& Request::getInstance();
$r->setModuleName('send_mail');
$r->setCrontabAllowed();
ApplicationController::init();
printDebug('==========================<br>
CRONTAB END/ <br>
==========================<br>
');
$crontab['date_last_success'] = getDateFromTimestamp(time());
saveConfigFile( $crontabFile, $crontab, "crontab");
}
$db->close();
redirectToUrlIfNecessary();
loadImage($logo, $idSite);
// flush content for display
if(DEBUG)
ob_end_flush();
?>
Code4
<?php
/*
* phpMyVisites : website statistics and audience measurements
* Copyright (C) 2002 - 2006
* http://www.phpmyvisites.net/
* phpMyVisites is free software (license GNU/GPL)
* Authors : phpMyVisites team
*/
// $Id: version.php 232 2007-07-06 09:31:19Z matthieu_ $
define('PHPMV_VERSION', '2.3');
?>
Je vous prie de bien vouloir m'aider
Cordialement votre
code1/<?php
/*
* phpMyVisites : website statistics and audience measurements
* Copyright (C) 2002 - 2006
* http://www.phpmyvisites.net/
* phpMyVisites is free software (license GNU/GPL)
* Authors : phpMyVisites team
*/
// $Id: config.inc.php 236 2007-11-04 15:04:08Z matthieu_ $
/**
* Maybe you want to edit these values (but be careful!)
*/
define('TIME_BEFORE_NEW_DAY_ARCHIVE', 10);//3600 * 3); // time before the current day is again archived when stats visited
define('INTERNAL_STATS', false); // define if phpmyvisites application statistics are saved
define('INTERNAL_CLICKHEAT', false); // define if phpmv app clicks are logged
define('SMARTY_DEBUG', false); // define if smarty is in debug mode (means CACHE activated, template build on each page, etc.)
define('DEFAULT_SITE', 1); // id of the site that is displayed after login (or -1 for summary)
define('CURRENT_DAY_SIMPLE_ARCHIVE', false); // define if current day archive is simplified or not
define('CURRENT_PERIOD_SIMPLE_ARCHIVE', false); // define if temp period archive is simplified or not
define('DEFAULT_DAY_TODAY', false); // is the default day today or yesterday?
define('ALL_POPULATION', false); // include all population or not
define('WEB_CRONTAB', true); // defines if the automatic crontab is activated or not (launched by the first visitor of each day). Must be desactivated if you setted a real crontab with the RSS feed (see FAQ)
define('SECURE_SERVER_HTTPS', false); // if true, the URLs constructed will be prefixed by https instead of http
define('COMPRESS_DB_DATA', true); // try to compress data before Database recording ? (can slow the process)
define('CATEGORY_DELIMITER', '/'); // category delimiter. Use '/' to make your categories automatically
define('TIME_TO_WAIT_FOR_PARALLEL_ARCHIVE', 40 * 60); // seconds to wait before try a new archive when a parallel archiving process is detected (also used in crontab task)
define('NB_IPS_RANGE_AVAILABLE', 10); // number of input for ip range exclude in the administration area
define('NB_URLS_ALIAS_AVAILABLE', 5); // number of input for urls alias in the administration area
define('NB_ELEMENTS_TO_DISPLAY', 10); // number of elements to display in tables (search engines, keywords, etc.)
define('DEFAULT_PAGE_NAME', 'index'); // default page name, when is like toto.com/ or toto.com/group1/group2/
define('PARAM_URL_PARTNER', 'pmv_pid'); // param name for identifying partner
define('PARAM_URL_NEWSLETTER', 'pmv_nid'); // param name for identifying newsletter
define('PREFIX_FILES', 'FILE:'); // prefix for files in the Javascript code Ex : pagename = 'FILE:group1/group2/group3/documentation.pdf'
define('PREFIX_ALL_TAG', 'FILE:'); // Liste of prefix for files,rss and pocast in the Javascript code Ex : pagename = 'FILE:group1/group2/group3/documentation.pdf'
define('MAX_DISTINCT_ELEMENTS', 300); // max elements (ex. number of keywords saved, number of distinct ISP)
define('MAX_DISTINCT_DETAILS_ELEMENTS', 300); // max distinct elements for details table (ex. number of keywords for a specific search engine)
define('MAX_DISTINCT_INTEREST_ELEMENTS', 150); // max elements used in Interest analysis
define('PMV_REWRITE_MODE', 'PEAR_REQUEST'); // [PEAR_REQUEST, URLREWRITE], PEAR_REQUEST : Use PEAR plugin with fsockopen (can be used if url is on the same server or if fsockopen is authorised with others servers), URLREWRITE (default) : rewrite url to the file
define('NEWSLETTER_FORCE_CREATE', false); // If phpmv recieve a call of a newsletter and if not exists : create the newsletter true ! error message : false
define('NEWSLETTER_CREATE_NAME', 'Newsletter : '); // Begining of the name when you force newsletter creation
define('NEWSLETTER_ID_MAX_AUTO', 100); // Max newsletter id create automatically (-1 no limit)
/**
* You shouldn't edit the values after this comment
*/
define('CACHE_SMARTY', 60*60*48); // define smarty cache lifetime
define('DEFAULT_TIME_PAGE', 20); // 20 sec per page if there isn't any page following (time standard!)
define('TIME_SLOW_QUERY', 0.05); // slow queries are loggued into database
define('PERCENT_MAX', 1000); // percent maximum born
define('THEME_DEFAULT', 'default'); // default theme directory
define('THEME_ADMIN', 'default'); // admin theme directory
define('STORE_PAG_ARRAY_IN_FILE', false); // store big page arrays in files. Increase performance for stat report, but uses disk space
define('NB_DAYS_FOR_RSS_ITEMS', 3); // days to compute to syndicate in the RSS sites (to multiply by number of sites ! be careful !)
define('ADMINISTRATOR_MAIL', 'phpmyvisites@gmail.com'); // mail that appears in the mail sent from phpmyvisites
define('CACHE_RSS_LIFETIME', 3600); // lifetime of the rss syndication file cache
define('CACHE_MAIL_LIFETIME', 3600); // lifetime of the mail file cache
define('PHP_VERSION_NEEDED', '4.3'); // version of php needed for phpmyvisites to work correctly
define('MEMORY_LIMIT', 16); // good value for memory limit
define('DEFAULT_MODULE', 'view_visits'); // name of the default module loaded
define('COOKIE_PMVLOG_NAME', 'pmv_ck_'); // cookie name for log
define('COOKIE_NAME_VIEW', 'pmv_ck_view_conf'); // cookie name for stats view
define('COOKIE_NAME_SESSION', 'pmv_ck_session'); // cookie name for session
define('COOKIE_NAME_NO_STAT', 'pmv_ck_no_stat'); // cookie name for session
define('MAX_LENGTH_ONE_VALUE_IN_COOKIE', 300); // length in byte
define('TIME_ONE_VISIT', 30*60); // time max for one visit (the time is normed) in seconds
define('MAX_LENGTH_JAVASCRIPT_A_VARS_ARRAY', 200); // max length for a variable value in the "var a_vars" javascript array in javascript code
define('COOKIE_EXPIRE', 86400*365*10); // time after which the cookie will expire
define('SECURE_TIME_BEFORE_NEW_ARCHIVE', 20); // time added to each archive's valid time for current day archives. It is a security to try to use the same archives for the graphs on the page
// For PHPMV_STAT_*, INTERNAL_STATS must be set to true
define('PMV_STAT_ID_SITE', 1); // Id of site where phpmv site must be saved (-1) : So create a site in phpmyvistes and set here, the id of this site
define('PMV_STAT_SAVE_USER', true); // true to have login name in variable of page viewed
// Other
if(!defined('DEBUG')) define('DEBUG', false);
define('DEFAULT_ACTION', false);
error_reporting( E_ALL );
if(DEBUG)
{
define('PRINT_TIME', false);
define('PRINT_QUERY_COUNT', true);
define('SAVE_DB_LOG', true);
define('PRINT_QUERY', true);
}
else
{
define('PRINT_QUERY', false);
define('PRINT_TIME', false);
define('PRINT_QUERY_COUNT', false);
define('SAVE_DB_LOG', false);
}
// relative directories
define('DIR_IMG_THEMES', './themes/'.THEME_DEFAULT.'/images/');
define('DIR_IMG_BROWSERS', './images/browsers');
define('DIR_IMG_OS', './images/os');
define('DIR_IMG_PLUGINS', './images/plugins');
define('DIR_IMG_LOGOS', './images/logos');
define('DIR_IMG_COUNTRIES_FLAGS', './images/countries_flags');
define('DIR_IMG_SCREENS', './images/screens');
define('DIR_IMG_SEARCH_ENGINES', './images/search_engines');
// absolute directories
define('LANGS_PATH', INCLUDE_PATH . '/langs');
define('DIR_IMG_MAPS', INCLUDE_PATH . '/images/maps');
define('DIR_CACHE_RSS', INCLUDE_PATH . '/datas/cache_lite/');
define('DIR_CACHE_MAIL', INCLUDE_PATH . '/datas/cache_lite/');
define('FONTS_PATH', INCLUDE_PATH . '/libs/artichow/font/');
// xhtml
define('HREF_DOC_OPEN', "<strong><a href='http://www.phpmyvisites.us/documentation/'>");
define('HREF_DOC_CLOSE', "</a></strong>");
define('HREF_FORUMS', "<strong><a href=\"http://www.phpmyvisites.us/forums/\" alt=\"{'head_titre'|translate}\" title=\"{'head_titre'|translate}\">http://www.phpmyvisites.us/forums/</a></strong>");
define('URL_SITE_EXAMPLE', 'http://www.site.com');
define('IP_EXAMPLE', 'A.B.C.D or A.B.C.x...');
define('GET_LIST_EXAMPLE', '<i>id;data;page</i>');
// archiving
define('REF_TYPE_SEARCH_ENGINE', 1);
define('REF_TYPE_SITE', 2);
define('REF_TYPE_PARTNER', 3);
define('REF_TYPE_NEWSLETTER', 4);
define('REF_TYPE_DIRECT_ENTRY', 5);
define('DB_ARCHIVES_PERIOD_DAY', 1);
define('DB_ARCHIVES_PERIOD_WEEK', 2);
define('DB_ARCHIVES_PERIOD_MONTH', 3);
define('DB_ARCHIVES_PERIOD_YEAR', 4);
define('DB_ARCHIVES_PERIOD_MISC_PERIOD', 5);
define('DB_ARCHIVES_DONE', 1);
define('DB_ARCHIVES_TEMP', 2);
define('DB_ARCHIVES_FAIL', 3);
define('ARRAY_INDEX_COUNT', 1);
define('ARRAY_INDEX_PAGE_NAME', 2);
define('ARRAY_INDEX_IDPAGE', 3);
define('ARRAY_INDEX_IDCATEGORY', 4);
define('ARRAY_INDEX_LEVEL', 5);
define('ARRAY_INDEX_IDPARENT', 6);
define('ARRAY_INDEX_TIME_TOTAL' , 7);
define('ARRAY_INDEX_ENTRYPAGE', 8);
define('ARRAY_INDEX_EXITPAGE', 9);
define('ARRAY_INDEX_VARS', 10);
define('ARRAY_INDEX_TYPE', 11);
define('ARRAY_INDEX_PAGES_VISIT_ONEPAGE', 12);
define('ARRAY_INDEX_PAGES_COUNT', 13);
define('ARRAY_INDEX_RETURNING_COUNT', 14);
define('ARRAY_INDEX_NEW_COUNT', 15);
define('ARRAY_INDEX_VAR_COUNT', 1);
define('ARRAY_INDEX_VAR_VALUE', 2);
define('ARRAY_TYPE_PAGE', 1);
define('ARRAY_TYPE_FILE', 2);
define('STAT_PAGE_PER_VISIT', 0);
define('STAT_PAGE_PER_VISIT_SIGNIFICANT', 1);
define('STAT_ONE_PAGE_RATE', 2);
define('STAT_TIME_PER_VISIT', 3);
define('DATE_NORMAL', 0);
define('DATE_GRAPH', 1);
define('DATE_GRAPH_LONG_AXIS', 2);
// Require
require_once INCLUDE_PATH."/version.php";
require_once INCLUDE_PATH."/core/datas/browserFamilies.php";
require_once INCLUDE_PATH."/core/datas/browsers.php";
require_once INCLUDE_PATH."/core/datas/countryList.php";
require_once INCLUDE_PATH."/core/datas/ispCountryList.php";
require_once INCLUDE_PATH."/core/datas/osLists.php";
require_once INCLUDE_PATH."/core/datas/pagesGap.php";
require_once INCLUDE_PATH."/core/datas/searchEngines.php";
require_once INCLUDE_PATH."/core/datas/timeGap.php";
require_once INCLUDE_PATH."/core/datas/fontList.php";
/**
* Simple function to replicate PHP 5 behaviour
*/
function getMicrotime()
{
list($usec, $sec) = explode(" ", microtime());
return ((float)$usec + (float)$sec);
}
$GLOBALS['time_start'] = getMicrotime();
$GLOBALS['query_count'] = 0; // number of queries of the page
$GLOBALS['a_content'] = array(); // cookie content
$GLOBALS['header_message_tpl'] = '';
$GLOBALS['header_error_message_tpl'] = '';
?>
Code2<?php
/*
* phpMyVisites : website statistics and audience measurements
* Copyright (C) 2002 - 2006
* http://www.phpmyvisites.net/
* phpMyVisites is free software (license GNU/GPL)
* Authors : phpMyVisites team
*/
// $Id: index.php 220 2007-06-27 10:01:07Z matthieu_ $
define('INCLUDE_PATH', '.');
define('PLUGINS_PATH', INCLUDE_PATH."/plugins/");
// For profiling, XDEBUG 2.x generates .out to be analysed with KcacheGrind or WinCacheGrind
@set_time_limit(0);
@error_reporting(E_ALL);
require_once INCLUDE_PATH . '/core/include/PmvConfig.class.php';
require_once INCLUDE_PATH . '/core/include/ApplicationController.php';
ApplicationController::init();
if( Request::moduleIsNotAStrangeModule() )
printTime('EOF', PRINT_TIME);
Code 3
<?php
/*
* phpMyVisites : website statistics and audience measurements
* Copyright (C) 2002 - 2006
* http://www.phpmyvisites.net/
* phpMyVisites is free software (license GNU/GPL)
* Authors : phpMyVisites team
*/
// $Id: phpmyvisites.php 218 2007-06-02 07:15:48Z cmil $
define('SAVE_STAT', true ); // default true
define('LOOK_FOR_COOKIE', true); // default true
define('DEBUG', false); // default false
define('TRACE_IN_FILES', false); // default false
define('INCLUDE_PATH', '.');
define('PRINT_COOKIE_CONTENT', false); // debug only : display cookie content for the current domain
define('PRINT_ALL_COOKIES_CONTENT', false); // debug only : display all pmv cookies for the current domain
// TODO dans le test du referer appartient au site, testez également en plus
// des sitesUrls le host de l'url de la page current sur le host de l'url ref
@ignore_user_abort(true);
@set_time_limit(0);
@error_reporting(E_ALL);
require_once INCLUDE_PATH."/core/include/Lang.class.php";
require_once INCLUDE_PATH.'/config.inc.php';
require_once INCLUDE_PATH."/core/include/Logs.functions.php";
require_once INCLUDE_PATH."/core/include/common.functions.php";
require_once INCLUDE_PATH."/core/include/Cookie.class.php";
require_once INCLUDE_PATH."/core/include/Site.class.php";
require_once INCLUDE_PATH."/core/include/PmvConfig.class.php";
if(!SAVE_STAT)
{
redirectToUrlIfNecessary();
// else, display pixel
$img = INCLUDE_PATH . "/images/logos/pixel.gif";
header("Content-type: image/gif");
readfile($img);
exit;
}
// hack for not to show tables (because getCurrentCompleteUrl bugs
// with url containing another url in one parameter)
$GLOBALS['currentModuleIsLogModule'] = true;
$c =& PmvConfig::getInstance();
$db =& Db::getInstance();
$db->connect();
// when no get specified, display a marketing page :)
if(sizeof($_GET) === 0)
{
require_once INCLUDE_PATH."/core/include/Lang.class.php";
$l =& Lang::getInstance();;
displayPageWhenEmptyGet();
exit;
}
if(DEBUG)
{
require_once INCLUDE_PATH."/core/include/functions.php";
}
if(DEBUG)
ob_start();
// - imprimer doc mysql "optimisation"
/*
* Get page & visitor information
*/
$idSite = getRequestVar('id', null, 'numeric');
$GLOBALS['cookie'] = new Cookie( COOKIE_PMVLOG_NAME . $idSite);
if(LOOK_FOR_COOKIE && $GLOBALS['cookie']->isDefined())
{
printDebug("<b>Cookie at the beginning (size : ".$GLOBALS['cookie']->getSize()." bytes)</b> :<br>");
printDebug($GLOBALS['cookie']->get());
$returningVisitor = 1;
}
else
{
$returningVisitor = 0;
printDebug("<b>Cookie not found !</b><br><br>");
}
$flash = getRequestVar('flash', 0, 'numeric');
$director = getRequestVar('director', 0, 'numeric');
$quicktime = getRequestVar('quicktime', 0, 'numeric');
$realPlayer = getRequestVar('realplayer', 0, 'numeric');
$windowsMedia = getRequestVar('windowsmedia', 0, 'numeric');
$cookieAccept = getRequestVar('cookie', 0, 'numeric'); // Don't name $cookie because conflict with $GLOBALS['cookie']
$pdf = getRequestVar('pdf', 0, 'numeric');
$java = getRequestVar('java', -1, 'numeric');
if ($java == -1) {
$javascript = 0;
$java = 0;
}
else {
$javascript = 1;
}
$refererUrl = getRequestVar('ref', '');
$typeTag = getRequestVar('type', "", 'string');
$site = new Site($idSite);
// debug cookie
if(PRINT_ALL_COOKIES_CONTENT)
{
require_once INCLUDE_PATH . "/core/include/DataModel.class.php";
$sitesId = $site->getSitesId();
foreach($sitesId as $sid)
{
$c = new Cookie( COOKIE_PMVLOG_NAME . $sid);
print($c->toString());
}
exit;
}
else if(PRINT_COOKIE_CONTENT)
{
print($GLOBALS['cookie']->toString());
exit;
}
/*
* site urls
*/
// commented in 2.3b3 because its actually not used
//if(!$siteUrls = $GLOBALS['cookie']->getVar('site_urls'))
//{
// $siteUrlsBefore = $site->getUrls();
// $siteUrls = array();
// if(is_array($siteUrlsBefore))
// {
// foreach($siteUrlsBefore as $url)
// {
// $url = trim($url);
// if( array_search( $url, $siteUrls) === false
// && !empty($url) )
// {
// $siteUrls[] = $url;
// }
// }
// }
// // save array of site urls in the cookie
// $GLOBALS['cookie']->setVar('site_urls', $siteUrls);
//}
/*
* site info
*/
//if(!$siteInfo = $GLOBALS['cookie']->getVar('site_info'))
//{
// $siteInfo = $site->getInfo();
//
// // save array of site urls in the cookie
// $GLOBALS['cookie']->setVar('site_info', $siteInfo);
//}
$logo = $site->getLogo();
$siteParams = $site->getParams();
$pageUrl = getRequestVar('url', '', 'string');
if ($pageUrl == "") {
// May be it is a bot !!
printDebug("No url : may be it's a bot ! So we don't save this visit !");
redirectToUrlIfNecessary();
loadImage($logo, $idSite);
exit();
}
// After modif js where we remove all before // in url
// We add http: to not have error in parse_url
if (substr($pageUrl, 0, 2) == "//") {
$pageUrl = "http:".$pageUrl;
}
/*
// Verify that url is in your site
$trouve = false;
foreach($siteUrls as $url)
{
$posInUrl = strpos($pageUrl, $url);
$trouve = ($posInUrl == 0);
}
if (! $trouve) {
printDebug("Url is not ok !");
redirectToUrlIfNecessary();
loadImage($logo, $idSite);
exit();
}
*/
/**
* exit if visitor is cookie excluded from the stats
*/
if(isset($_COOKIE[COOKIE_NAME_NO_STAT.$site->getId()]))
{
printDebug("Excluded from stats with the cookie!");
redirectToUrlIfNecessary();
loadImage($logo, $idSite);
}
/*
* page variables
*/
$a_vars = getRequestVar('a_vars', array(), 'array');
/*
* visitor config, as saved in the database
*/
$userAgent = secureVar(@$_SERVER['HTTP_USER_AGENT']);
$os = getOs($userAgent);
$a_browser = getBrowserInfo($userAgent);
$resolution = getRequestVar('res', 'unknown', 'string');
$colorDepth = getRequestVar('col', 32, 'numeric');
$browserLang = secureVar(@$_SERVER['HTTP_ACCEPT_LANGUAGE']);
$localTime = getRequestVar('h',date("H"),'numeric').':'.
getRequestVar('m',date("i"),'numeric').':'.getRequestVar('s',date("s"),'numeric');
// assign pageCategory default value of the parse_url::path?query
$pageUrlParamsProcessed = processParams($pageUrl, $siteParams);
// fix add site.com because else parse_url bugs with ':' in query string
if(!ereg('^http://',$pageUrlParamsProcessed))
{
$urlParse = parse_url('http://site.com'.$pageUrlParamsProcessed);
}
else
{
$urlParse = parse_url($pageUrlParamsProcessed);
}
if(isset($urlParse['path']))
{
$pageNameDefault = substr($urlParse['path'], 1);
}
if(isset($urlParse['query']))
{
$pageNameDefault .= '?'.$urlParse['query'];
}
if( (!isset($pageNameDefault)
|| strcmp($pageNameDefault, '')===0)
&& isset($urlParse['host'])
)
{
$pageNameDefault = DEFAULT_PAGE_NAME;
}
else if(!isset($pageNameDefault))
{
$pageNameDefault = null;
}
printDebug("PageNameDefault : " . $pageNameDefault);
// stripslashed because otherwise pageName if value is pageNameDefault is slashed twice
$pageCompleteName = utf8_encode(getRequestVar('pagename' ,
stripslashes(html_entity_decode($pageNameDefault))
)
);
$pageCompleteName = str_replace(array("\n", "\r"), '', $pageCompleteName);
$pageCompleteName = str_replace(array("?"), '', $pageCompleteName);
if ($typeTag != "") {
$pageCompleteName = $typeTag.":".$pageCompleteName;
}
// works only on 'path' of this url because the query may contain delimiter !
$file = '';
//if(substr($pageCompleteName, 0, 5) === PREFIX_FILES)
if(isPrefixTag ($pageCompleteName))
{
// $file = PREFIX_FILES;
$file = getPrefixTag($pageCompleteName);
}
printDebug("<br>Page complete name:".$pageCompleteName);
$urlParse = parse_url('http://site.com/'.$pageCompleteName);
$pageCompleteNamePath = substr($urlParse['path'],1);
$lastDelimiter = strrpos($pageCompleteNamePath, CATEGORY_DELIMITER);
printDebug("<br>Page name complete path:".$pageCompleteNamePath);
printDebug("<br>Pos last delimiter : $lastDelimiter");
if($lastDelimiter !== false)
{
// in the $pageCompleteName "g1>g2>page" select only "g1>g2"
$pageCategory = substr($pageCompleteNamePath, 0, $lastDelimiter);
// $pageCategory = str_replace( PREFIX_FILES, '', $pageCategory);
$tabTag = split(",", PREFIX_ALL_TAG);
foreach ($tabTag as $info) {
$pageCategory = str_replace($info, '', $pageCategory);
}
if($pageCategory == '/'
|| $pageCategory == ' '
|| $pageCategory == '+'
|| $pageCategory == '-'
|| $pageCategory == '"'
|| $pageCategory == '\''
)
{
$pageCategory = '';
}
// in the $pageCompleteName "g1>g2>page" select only "page"
// if pageCompleteNamePath bug when all variables recorded, no pagename, only save index.php
$pageName = $file . substr($pageCompleteName, $lastDelimiter + 1);
}
else
{
$pageCategory = '';
$pageName = $pageCompleteName;
}
//var_dump($pageCategory);exit;
// concerning names of pages in subgroups like /g1/g2/g3/ without page names
if(strcmp($pageName, '')===0)
{
$pageName = DEFAULT_PAGE_NAME;
}
printDebug('<br>URL : '.$pageUrl);
printDebug('<br>typeTag : '.$typeTag);
printDebug('<br>pageName : '.$pageName);
printDebug('<br>pageCategory : '.$pageCategory);
printDebug('<br>a_vars : '); printDebug($a_vars);
printDebug('<br>referer : '); printDebug($refererUrl);
printDebug('<br>flash : '.$flash);
printDebug('<br>director : '.$director);
printDebug('<br>quicktime : '.$quicktime);
printDebug('<br>real player : '.$realPlayer);
printDebug('<br>windows media : '.$windowsMedia);
printDebug('<br>cookie : '.$cookieAccept);
printDebug('<br>PDF : '.$pdf);
printDebug('<br>java : '.$java);
printDebug('<br>javascript : '.$javascript);
printDebug('<br>referer Url : '.$refererUrl);
printDebug('<br>id site : '.$idSite);
//printDebug('<br>site Urls : '); printDebug($siteUrls);
//printDebug('<br>site Info : '); printDebug($siteInfo);
printDebug('<br>user Agent : '.$userAgent);
printDebug('<br>os : '.$os);
printDebug('<br>browser : '.$a_browser['longName']);
printDebug('<br>resolution : '.$resolution);
printDebug('<br>color : '.$colorDepth);
/**
* other information
*/
$todayDate = date("Y-m-d");
/**
* try to recognize the visitor, with or without cookie
* who said we are very strong ?
*/
// last_visit = last visit timestamp
// idcookie = id cookie
printDebug("<br><strong>Try to recognize the visitor...</strong><br>");
function saveCountInFile( $fileName )
{
$count = 0;
$fileName = './count/'.$fileName;
if(is_file($fileName))
{
include($fileName);
if(isset($count) && is_integer($count) && $count != 0)
{
saveConfigFile( $fileName, $count+1, "count");
}
}
}
if(TRACE_IN_FILES) saveCountInFile( 'p_total' );
$timeDiffRef = DEFAULT_TIME_PAGE;
// does phpmyvisites cookie exist ?
if($GLOBALS['cookie']->isDefined())
{
// yes, known visitor
$idVisit = $GLOBALS['cookie']->getVar('idvisit');
$idCookie = $GLOBALS['cookie']->getVar('idcookie');
$lastVisit = $GLOBALS['cookie']->getVar('last_visit_time');
$serverTime = $GLOBALS['cookie']->getVar('server_time');
$serverDate = $GLOBALS['cookie']->getVar('server_date');
$idPageRef = $GLOBALS['cookie']->getVar('idpage_ref');
if(TRACE_IN_FILES) saveCountInFile( 'p_cookie' );
if(DEBUG)
printDebug("<br>We know the visitor (thanks to his cookie).
<br>He has idvisit = $idVisit and went last time on
".getTimeForDisplay($lastVisit)."<br>");
}
else
{
printDebug("=>We can't find the cookie...<br>");
if(TRACE_IN_FILES) saveCountInFile( 'p_non_cookie' );
// compute IP
$ip = getIp();
$ip2long = ip2long($ip);
exitIfIpExcluded($ip2long, $logo, $site);
$serverDate = $todayDate;
$tryPutCookie = true;
//edit 2.2RC3 now we check all the time, because if someone refresh the home page 100 times
// and didn't accept cookies, it was counted 100 visitors!!
/*
if($site->isUrlIn($refererUrl))
{
printDebug("=> Referer Is in the site ! try to catch the visitor...<br>");
if(TRACE_IN_FILES) saveCountInFile( 'p_ref_url_in' );
}
*/
$md5Config = md5( $os . serialize($a_browser) . $resolution . $colorDepth . $pdf
. $flash . $java . $javascript . $director . $quicktime . $realPlayer . $windowsMedia . $cookieAccept
. $ip2long . $browserLang);
// does the config (os+browser+resolution+color_depth) and the IP match any visitor ?
$r = query("SELECT idvisit, idcookie, TIME_TO_SEC(last_visit_time),
TIME_TO_SEC(server_time), exit_idpage
FROM ".T_VISIT."
WHERE server_date = '$todayDate'
AND idsite = '$idSite'
AND md5config = '$md5Config'
ORDER BY last_visit_time DESC
LIMIT 1");
if(mysql_num_rows($r)>0)
{
// yes
$r = mysql_fetch_row($r);
$idVisit = $r[0];
$idCookie = $r[1];
$lastVisit = $r[2];
$serverTime = $r[3];
$idPageRef = $r[4];
if(TRACE_IN_FILES) saveCountInFile( 'p_ref_url_in_found' );
printDebug("=> We found the MD5CONFIG of visitor so he is known<br>");
}
// case we didn't match any visitor
if(!isset($idVisit))
{
// no, new visitor
$newVisitor = true;
if(TRACE_IN_FILES) saveCountInFile( 'p_ref_not_found' );
printDebug("=> It's definitely a new visitor<br>");
}
}
if(isset($lastVisit)
&& $lastVisit !== false
&& $lastVisit < todayTime() // case the lastVisit value has been spoiled
)
{
$timeDiffRef = todayTime() - $lastVisit;
// case the lastVisit value has been spoiled (BIS)
$timeDiffRef = min($timeDiffRef, TIME_ONE_VISIT);
}
if(!isset($idPageRef)
|| $idPageRef === false )
{
$idPageRef = 0;
}
else
{
printDebug("We know its page ref id=$idPageRef and he stayed on it $timeDiffRef seconds <br>");
}
/**
* Current visitor is a new visitor or an old one
* but without cookie, so we put a cookie
*/
if(isset($newVisitor) || isset($tryPutCookie))
{
// record it and set the cookie
$idCookie = $GLOBALS['cookie']->put(isset($idCookie)?$idCookie:'');
// case : visitor known but cookie not set during his first page views...
if(isset($idVisit))
{
$GLOBALS['cookie']->setVar('idvisit', $idVisit);
}
else
{
$lastVisit = todayTime();
}
}
/**
* Visitor is known, we now look if it's a new visit or not
*/
// is the visit older than 30 minutes ?
if(!isset($newVisitor))
{
if(DEBUG)
printDebug("(idvisit = $idVisit, ".getTimeForDisplay($serverTime)." | now : " .
todayTime()." :: first page last time : $serverTime)");
if ($serverDate == date("Y-m-d")
&& ($lastVisit > (todayTime() - TIME_ONE_VISIT))
)
{
// yes, new visit
$GLOBALS['cookie']->setVar('last_visit_time', todayTime());
$knownVisit = true;
printDebug("<br><b>=>Visit is known on date : $serverDate</b><br>");
}
else
{
printDebug("=>Last visit is too old <b>==> New visit</b><br>");
$returningVisitor = 1;
}
}
else
{
printDebug("<br><b>=>New Visitor also means new visit</b><br>");
}
/**
* Current visit is a known visit
*/
// save current page, etc.
if(isset($knownVisit) && $knownVisit)
{
// we know
// * $lastVisit
// * $idVisit
// * $idCookie
// update last_visit_time
printDebug("==> This is a visit known... we update the data <br>");
// do it first because we need idpage for visit info insert
//print("$pageName <br> $pageUrl <br> $pageCategory ");exit;
$a_idPages = recordDbPage($pageName, $pageUrlParamsProcessed, $pageCategory, false);
$idPage = $a_idPages[0];
// save current page & url & variables information
$idLink_vp = recordDbInfoPage($idVisit, $idPage, $idPageRef, $timeDiffRef, $a_vars);
$total_time = DEFAULT_TIME_PAGE + todayTime() - $serverTime;
// update last_visit_time & total_pages & c_total_time
$r = query("UPDATE ".T_VISIT."
SET last_visit_time = CURRENT_TIME(),
total_pages = total_pages + 1,
total_time = '$total_time',
exit_idpage = '$idPage'
WHERE idvisit = '$idVisit'
LIMIT 1");
}
/*
* Current visit a new visit
*/
// now we know the visitor and its idcookie
// save new visit
else
{
printDebug("==> This is a new visit, we create datas in the database when necessary<br>");
if(!isset($ip) || !isset($ip2long))
{
$ip = getIp();
$ip2long = ip2long($ip);
exitIfIpExcluded($ip2long, $logo, $site);
}
$hostExt = getHostnameExt(getHost($ip));
printDebug('<br>ip : '.$ip);
printDebug('<br>hostname : '.$hostExt);
$serverDate = date("Y-m-d");
$serverTime = date("H:i:s");
$country = getCountry($hostExt, $browserLang);
if($country == 'gb')
{
$country = 'uk';
}
$continent = getContinent($country);
if(strlen($refererUrl)===0)
{
$refererUrl = 'NULL';
}
else
{
$refererUrl = "'".$refererUrl."'";
}
// do it first because we need idpage for visit info insert
$a_idPages = recordDbPage($pageName, $pageUrlParamsProcessed, $pageCategory, true);
$idPageUrl = $a_idPages[1];
$idPage = $a_idPages[0];
$md5Config = md5( $os . serialize($a_browser) . $resolution . $colorDepth . $pdf
. $flash . $java . $javascript . $director . $quicktime . $realPlayer . $windowsMedia . $cookieAccept
. $ip2long . $browserLang);
// save visitor information
$r = query("INSERT INTO ".T_VISIT."
(idsite, idcookie, returning, last_visit_time, server_date, server_time, md5config,
referer, os, browser_name, browser_version, resolution, color_depth,
pdf, flash, java, javascript, director, quicktime, realplayer, windowsmedia, cookie,
local_time, ip, hostname_ext, browser_lang, country, continent,
total_pages, total_time, entry_idpage, entry_idpageurl, exit_idpage)
VALUES ('$idSite', '$idCookie', '$returningVisitor', CURRENT_TIME(),
'$serverDate', '$serverTime', '$md5Config',
$refererUrl, '$os', '".$a_browser['shortName']."',
'".$a_browser['version']."', '$resolution', '$colorDepth',
'$pdf', '$flash','$java', '$javascript', '$director', '$quicktime', '$realPlayer', '$windowsMedia', '$cookieAccept',
'$localTime','$ip2long', '$hostExt', '$browserLang', '$country', '$continent',
1, '".DEFAULT_TIME_PAGE ."', '$idPage', '$idPageUrl', '$idPage')
");
$idVisit = mysql_insert_id();
// save page view and URL and variables
recordDbInfoPage($idVisit, $idPage, $idPageRef, $timeDiffRef, $a_vars);
// save idvisit
$GLOBALS['cookie']->setVar('idvisit', $idVisit);
$GLOBALS['cookie']->setVar('last_visit_time', todayTime());
$GLOBALS['cookie']->setVar('server_time', todayTime());
$GLOBALS['cookie']->setVar('server_date', $serverDate);
}
$GLOBALS['cookie']->setVar('idpage_ref', $idPage);
$GLOBALS['cookie']->save();
printDebug("<br><b>Next cookie should be :</b>");
printDebug($GLOBALS['cookie']->getContent());
// footer
if(PRINT_QUERY_COUNT)
printQueryCount();
if(PRINT_TIME)
printTime();
if(SAVE_DB_LOG)
{
recordDbQueryCount($idSite);
}
require_once INCLUDE_PATH . "/core/include/common.functions.php";
$crontabFile = INCLUDE_PATH . "/config/crontab.php";
if(is_file($crontabFile))
{
include($crontabFile);
}
if( WEB_CRONTAB
&& is_writable( $crontabFile)
&&
(
// if crontab doesn't exist in the file or the file doesn't exist
// or if the last try was before today
( !isset($crontab)
|| $crontab['date_last_success'] != getDateFromTimestamp(time())
)
&&
(
!is_file($crontabFile)
|| ( isset($crontab)
&& $crontab['time_last_try'] < time() - TIME_TO_WAIT_FOR_PARALLEL_ARCHIVE // every 5min
)
)
)
)
{
$crontab['time_last_try'] = time();
$crontab['date_last_success'] = '2000-12-31';
saveConfigFile( $crontabFile, $crontab, "crontab");
printDebug('==========================<br>
CRONTAB BEGIN/ <br>
==========================<br>
');
require_once INCLUDE_PATH . '/core/include/PmvConfig.class.php';
require_once INCLUDE_PATH . '/core/include/ApplicationController.php';
$r =& Request::getInstance();
$r->setModuleName('send_mail');
$r->setCrontabAllowed();
ApplicationController::init();
printDebug('==========================<br>
CRONTAB END/ <br>
==========================<br>
');
$crontab['date_last_success'] = getDateFromTimestamp(time());
saveConfigFile( $crontabFile, $crontab, "crontab");
}
$db->close();
redirectToUrlIfNecessary();
loadImage($logo, $idSite);
// flush content for display
if(DEBUG)
ob_end_flush();
?>
Code4
<?php
/*
* phpMyVisites : website statistics and audience measurements
* Copyright (C) 2002 - 2006
* http://www.phpmyvisites.net/
* phpMyVisites is free software (license GNU/GPL)
* Authors : phpMyVisites team
*/
// $Id: version.php 232 2007-07-06 09:31:19Z matthieu_ $
define('PHPMV_VERSION', '2.3');
?>
Je vous prie de bien vouloir m'aider
Cordialement votre
j'ai téléchargé des codes et je ne sais pas lequel installer
Code1
<?php
/*
* phpMyVisites : website statistics and audience measurements
* Copyright (C) 2002 - 2006
* http://www.phpmyvisites.net/
* phpMyVisites is free software (license GNU/GPL)
* Authors : phpMyVisites team
*/
// $Id: config.inc.php 236 2007-11-04 15:04:08Z matthieu_ $
/**
* Maybe you want to edit these values (but be careful!)
*/
define('TIME_BEFORE_NEW_DAY_ARCHIVE', 10);//3600 * 3); // time before the current day is again archived when stats visited
define('INTERNAL_STATS', false); // define if phpmyvisites application statistics are saved
define('INTERNAL_CLICKHEAT', false); // define if phpmv app clicks are logged
define('SMARTY_DEBUG', false); // define if smarty is in debug mode (means CACHE activated, template build on each page, etc.)
define('DEFAULT_SITE', 1); // id of the site that is displayed after login (or -1 for summary)
define('CURRENT_DAY_SIMPLE_ARCHIVE', false); // define if current day archive is simplified or not
define('CURRENT_PERIOD_SIMPLE_ARCHIVE', false); // define if temp period archive is simplified or not
define('DEFAULT_DAY_TODAY', false); // is the default day today or yesterday?
define('ALL_POPULATION', false); // include all population or not
define('WEB_CRONTAB', true); // defines if the automatic crontab is activated or not (launched by the first visitor of each day). Must be desactivated if you setted a real crontab with the RSS feed (see FAQ)
define('SECURE_SERVER_HTTPS', false); // if true, the URLs constructed will be prefixed by https instead of http
define('COMPRESS_DB_DATA', true); // try to compress data before Database recording ? (can slow the process)
define('CATEGORY_DELIMITER', '/'); // category delimiter. Use '/' to make your categories automatically
define('TIME_TO_WAIT_FOR_PARALLEL_ARCHIVE', 40 * 60); // seconds to wait before try a new archive when a parallel archiving process is detected (also used in crontab task)
define('NB_IPS_RANGE_AVAILABLE', 10); // number of input for ip range exclude in the administration area
define('NB_URLS_ALIAS_AVAILABLE', 5); // number of input for urls alias in the administration area
define('NB_ELEMENTS_TO_DISPLAY', 10); // number of elements to display in tables (search engines, keywords, etc.)
define('DEFAULT_PAGE_NAME', 'index'); // default page name, when is like toto.com/ or toto.com/group1/group2/
define('PARAM_URL_PARTNER', 'pmv_pid'); // param name for identifying partner
define('PARAM_URL_NEWSLETTER', 'pmv_nid'); // param name for identifying newsletter
define('PREFIX_FILES', 'FILE:'); // prefix for files in the Javascript code Ex : pagename = 'FILE:group1/group2/group3/documentation.pdf'
define('PREFIX_ALL_TAG', 'FILE:'); // Liste of prefix for files,rss and pocast in the Javascript code Ex : pagename = 'FILE:group1/group2/group3/documentation.pdf'
define('MAX_DISTINCT_ELEMENTS', 300); // max elements (ex. number of keywords saved, number of distinct ISP)
define('MAX_DISTINCT_DETAILS_ELEMENTS', 300); // max distinct elements for details table (ex. number of keywords for a specific search engine)
define('MAX_DISTINCT_INTEREST_ELEMENTS', 150); // max elements used in Interest analysis
define('PMV_REWRITE_MODE', 'PEAR_REQUEST'); // [PEAR_REQUEST, URLREWRITE], PEAR_REQUEST : Use PEAR plugin with fsockopen (can be used if url is on the same server or if fsockopen is authorised with others servers), URLREWRITE (default) : rewrite url to the file
define('NEWSLETTER_FORCE_CREATE', false); // If phpmv recieve a call of a newsletter and if not exists : create the newsletter true ! error message : false
define('NEWSLETTER_CREATE_NAME', 'Newsletter : '); // Begining of the name when you force newsletter creation
define('NEWSLETTER_ID_MAX_AUTO', 100); // Max newsletter id create automatically (-1 no limit)
/**
* You shouldn't edit the values after this comment
*/
define('CACHE_SMARTY', 60*60*48); // define smarty cache lifetime
define('DEFAULT_TIME_PAGE', 20); // 20 sec per page if there isn't any page following (time standard!)
define('TIME_SLOW_QUERY', 0.05); // slow queries are loggued into database
define('PERCENT_MAX', 1000); // percent maximum born
define('THEME_DEFAULT', 'default'); // default theme directory
define('THEME_ADMIN', 'default'); // admin theme directory
define('STORE_PAG_ARRAY_IN_FILE', false); // store big page arrays in files. Increase performance for stat report, but uses disk space
define('NB_DAYS_FOR_RSS_ITEMS', 3); // days to compute to syndicate in the RSS sites (to multiply by number of sites ! be careful !)
define('ADMINISTRATOR_MAIL', 'phpmyvisites@gmail.com'); // mail that appears in the mail sent from phpmyvisites
define('CACHE_RSS_LIFETIME', 3600); // lifetime of the rss syndication file cache
define('CACHE_MAIL_LIFETIME', 3600); // lifetime of the mail file cache
define('PHP_VERSION_NEEDED', '4.3'); // version of php needed for phpmyvisites to work correctly
define('MEMORY_LIMIT', 16); // good value for memory limit
define('DEFAULT_MODULE', 'view_visits'); // name of the default module loaded
define('COOKIE_PMVLOG_NAME', 'pmv_ck_'); // cookie name for log
define('COOKIE_NAME_VIEW', 'pmv_ck_view_conf'); // cookie name for stats view
define('COOKIE_NAME_SESSION', 'pmv_ck_session'); // cookie name for session
define('COOKIE_NAME_NO_STAT', 'pmv_ck_no_stat'); // cookie name for session
define('MAX_LENGTH_ONE_VALUE_IN_COOKIE', 300); // length in byte
define('TIME_ONE_VISIT', 30*60); // time max for one visit (the time is normed) in seconds
define('MAX_LENGTH_JAVASCRIPT_A_VARS_ARRAY', 200); // max length for a variable value in the "var a_vars" javascript array in javascript code
define('COOKIE_EXPIRE', 86400*365*10); // time after which the cookie will expire
define('SECURE_TIME_BEFORE_NEW_ARCHIVE', 20); // time added to each archive's valid time for current day archives. It is a security to try to use the same archives for the graphs on the page
// For PHPMV_STAT_*, INTERNAL_STATS must be set to true
define('PMV_STAT_ID_SITE', 1); // Id of site where phpmv site must be saved (-1) : So create a site in phpmyvistes and set here, the id of this site
define('PMV_STAT_SAVE_USER', true); // true to have login name in variable of page viewed
// Other
if(!defined('DEBUG')) define('DEBUG', false);
define('DEFAULT_ACTION', false);
error_reporting( E_ALL );
if(DEBUG)
{
define('PRINT_TIME', false);
define('PRINT_QUERY_COUNT', true);
define('SAVE_DB_LOG', true);
define('PRINT_QUERY', true);
}
else
{
define('PRINT_QUERY', false);
define('PRINT_TIME', false);
define('PRINT_QUERY_COUNT', false);
define('SAVE_DB_LOG', false);
}
// relative directories
define('DIR_IMG_THEMES', './themes/'.THEME_DEFAULT.'/images/');
define('DIR_IMG_BROWSERS', './images/browsers');
define('DIR_IMG_OS', './images/os');
define('DIR_IMG_PLUGINS', './images/plugins');
define('DIR_IMG_LOGOS', './images/logos');
define('DIR_IMG_COUNTRIES_FLAGS', './images/countries_flags');
define('DIR_IMG_SCREENS', './images/screens');
define('DIR_IMG_SEARCH_ENGINES', './images/search_engines');
// absolute directories
define('LANGS_PATH', INCLUDE_PATH . '/langs');
define('DIR_IMG_MAPS', INCLUDE_PATH . '/images/maps');
define('DIR_CACHE_RSS', INCLUDE_PATH . '/datas/cache_lite/');
define('DIR_CACHE_MAIL', INCLUDE_PATH . '/datas/cache_lite/');
define('FONTS_PATH', INCLUDE_PATH . '/libs/artichow/font/');
// xhtml
define('HREF_DOC_OPEN', "<strong><a href='http://www.phpmyvisites.us/documentation/'>");
define('HREF_DOC_CLOSE', "</a></strong>");
define('HREF_FORUMS', "<strong><a href=\"http://www.phpmyvisites.us/forums/\" alt=\"{'head_titre'|translate}\" title=\"{'head_titre'|translate}\">http://www.phpmyvisites.us/forums/</a></strong>");
define('URL_SITE_EXAMPLE', 'http://www.site.com');
define('IP_EXAMPLE', 'A.B.C.D or A.B.C.x...');
define('GET_LIST_EXAMPLE', '<i>id;data;page</i>');
// archiving
define('REF_TYPE_SEARCH_ENGINE', 1);
define('REF_TYPE_SITE', 2);
define('REF_TYPE_PARTNER', 3);
define('REF_TYPE_NEWSLETTER', 4);
define('REF_TYPE_DIRECT_ENTRY', 5);
define('DB_ARCHIVES_PERIOD_DAY', 1);
define('DB_ARCHIVES_PERIOD_WEEK', 2);
define('DB_ARCHIVES_PERIOD_MONTH', 3);
define('DB_ARCHIVES_PERIOD_YEAR', 4);
define('DB_ARCHIVES_PERIOD_MISC_PERIOD', 5);
define('DB_ARCHIVES_DONE', 1);
define('DB_ARCHIVES_TEMP', 2);
define('DB_ARCHIVES_FAIL', 3);
define('ARRAY_INDEX_COUNT', 1);
define('ARRAY_INDEX_PAGE_NAME', 2);
define('ARRAY_INDEX_IDPAGE', 3);
define('ARRAY_INDEX_IDCATEGORY', 4);
define('ARRAY_INDEX_LEVEL', 5);
define('ARRAY_INDEX_IDPARENT', 6);
define('ARRAY_INDEX_TIME_TOTAL' , 7);
define('ARRAY_INDEX_ENTRYPAGE', 8);
define('ARRAY_INDEX_EXITPAGE', 9);
define('ARRAY_INDEX_VARS', 10);
define('ARRAY_INDEX_TYPE', 11);
define('ARRAY_INDEX_PAGES_VISIT_ONEPAGE', 12);
define('ARRAY_INDEX_PAGES_COUNT', 13);
define('ARRAY_INDEX_RETURNING_COUNT', 14);
define('ARRAY_INDEX_NEW_COUNT', 15);
define('ARRAY_INDEX_VAR_COUNT', 1);
define('ARRAY_INDEX_VAR_VALUE', 2);
define('ARRAY_TYPE_PAGE', 1);
define('ARRAY_TYPE_FILE', 2);
define('STAT_PAGE_PER_VISIT', 0);
define('STAT_PAGE_PER_VISIT_SIGNIFICANT', 1);
define('STAT_ONE_PAGE_RATE', 2);
define('STAT_TIME_PER_VISIT', 3);
define('DATE_NORMAL', 0);
define('DATE_GRAPH', 1);
define('DATE_GRAPH_LONG_AXIS', 2);
// Require
require_once INCLUDE_PATH."/version.php";
require_once INCLUDE_PATH."/core/datas/browserFamilies.php";
require_once INCLUDE_PATH."/core/datas/browsers.php";
require_once INCLUDE_PATH."/core/datas/countryList.php";
require_once INCLUDE_PATH."/core/datas/ispCountryList.php";
require_once INCLUDE_PATH."/core/datas/osLists.php";
require_once INCLUDE_PATH."/core/datas/pagesGap.php";
require_once INCLUDE_PATH."/core/datas/searchEngines.php";
require_once INCLUDE_PATH."/core/datas/timeGap.php";
require_once INCLUDE_PATH."/core/datas/fontList.php";
/**
* Simple function to replicate PHP 5 behaviour
*/
function getMicrotime()
{
list($usec, $sec) = explode(" ", microtime());
return ((float)$usec + (float)$sec);
}
$GLOBALS['time_start'] = getMicrotime();
$GLOBALS['query_count'] = 0; // number of queries of the page
$GLOBALS['a_content'] = array(); // cookie content
$GLOBALS['header_message_tpl'] = '';
$GLOBALS['header_error_message_tpl'] = '';
?>
Code2
<?php
/*
* phpMyVisites : website statistics and audience measurements
* Copyright (C) 2002 - 2006
* http://www.phpmyvisites.net/
* phpMyVisites is free software (license GNU/GPL)
* Authors : phpMyVisites team
*/
// $Id: index.php 220 2007-06-27 10:01:07Z matthieu_ $
define('INCLUDE_PATH', '.');
define('PLUGINS_PATH', INCLUDE_PATH."/plugins/");
// For profiling, XDEBUG 2.x generates .out to be analysed with KcacheGrind or WinCacheGrind
@set_time_limit(0);
@error_reporting(E_ALL);
require_once INCLUDE_PATH . '/core/include/PmvConfig.class.php';
require_once INCLUDE_PATH . '/core/include/ApplicationController.php';
ApplicationController::init();
if( Request::moduleIsNotAStrangeModule() )
printTime('EOF', PRINT_TIME);
?>
Code3
<?php
/*
* phpMyVisites : website statistics and audience measurements
* Copyright (C) 2002 - 2006
* http://www.phpmyvisites.net/
* phpMyVisites is free software (license GNU/GPL)
* Authors : phpMyVisites team
*/
// $Id: phpmyvisites.php 218 2007-06-02 07:15:48Z cmil $
define('SAVE_STAT', true ); // default true
define('LOOK_FOR_COOKIE', true); // default true
define('DEBUG', false); // default false
define('TRACE_IN_FILES', false); // default false
define('INCLUDE_PATH', '.');
define('PRINT_COOKIE_CONTENT', false); // debug only : display cookie content for the current domain
define('PRINT_ALL_COOKIES_CONTENT', false); // debug only : display all pmv cookies for the current domain
// TODO dans le test du referer appartient au site, testez également en plus
// des sitesUrls le host de l'url de la page current sur le host de l'url ref
@ignore_user_abort(true);
@set_time_limit(0);
@error_reporting(E_ALL);
require_once INCLUDE_PATH."/core/include/Lang.class.php";
require_once INCLUDE_PATH.'/config.inc.php';
require_once INCLUDE_PATH."/core/include/Logs.functions.php";
require_once INCLUDE_PATH."/core/include/common.functions.php";
require_once INCLUDE_PATH."/core/include/Cookie.class.php";
require_once INCLUDE_PATH."/core/include/Site.class.php";
require_once INCLUDE_PATH."/core/include/PmvConfig.class.php";
if(!SAVE_STAT)
{
redirectToUrlIfNecessary();
// else, display pixel
$img = INCLUDE_PATH . "/images/logos/pixel.gif";
header("Content-type: image/gif");
readfile($img);
exit;
}
// hack for not to show tables (because getCurrentCompleteUrl bugs
// with url containing another url in one parameter)
$GLOBALS['currentModuleIsLogModule'] = true;
$c =& PmvConfig::getInstance();
$db =& Db::getInstance();
$db->connect();
// when no get specified, display a marketing page :)
if(sizeof($_GET) === 0)
{
require_once INCLUDE_PATH."/core/include/Lang.class.php";
$l =& Lang::getInstance();;
displayPageWhenEmptyGet();
exit;
}
if(DEBUG)
{
require_once INCLUDE_PATH."/core/include/functions.php";
}
if(DEBUG)
ob_start();
// - imprimer doc mysql "optimisation"
/*
* Get page & visitor information
*/
$idSite = getRequestVar('id', null, 'numeric');
$GLOBALS['cookie'] = new Cookie( COOKIE_PMVLOG_NAME . $idSite);
if(LOOK_FOR_COOKIE && $GLOBALS['cookie']->isDefined())
{
printDebug("<b>Cookie at the beginning (size : ".$GLOBALS['cookie']->getSize()." bytes)</b> :<br>");
printDebug($GLOBALS['cookie']->get());
$returningVisitor = 1;
}
else
{
$returningVisitor = 0;
printDebug("<b>Cookie not found !</b><br><br>");
}
$flash = getRequestVar('flash', 0, 'numeric');
$director = getRequestVar('director', 0, 'numeric');
$quicktime = getRequestVar('quicktime', 0, 'numeric');
$realPlayer = getRequestVar('realplayer', 0, 'numeric');
$windowsMedia = getRequestVar('windowsmedia', 0, 'numeric');
$cookieAccept = getRequestVar('cookie', 0, 'numeric'); // Don't name $cookie because conflict with $GLOBALS['cookie']
$pdf = getRequestVar('pdf', 0, 'numeric');
$java = getRequestVar('java', -1, 'numeric');
if ($java == -1) {
$javascript = 0;
$java = 0;
}
else {
$javascript = 1;
}
$refererUrl = getRequestVar('ref', '');
$typeTag = getRequestVar('type', "", 'string');
$site = new Site($idSite);
// debug cookie
if(PRINT_ALL_COOKIES_CONTENT)
{
require_once INCLUDE_PATH . "/core/include/DataModel.class.php";
$sitesId = $site->getSitesId();
foreach($sitesId as $sid)
{
$c = new Cookie( COOKIE_PMVLOG_NAME . $sid);
print($c->toString());
}
exit;
}
else if(PRINT_COOKIE_CONTENT)
{
print($GLOBALS['cookie']->toString());
exit;
}
/*
* site urls
*/
// commented in 2.3b3 because its actually not used
//if(!$siteUrls = $GLOBALS['cookie']->getVar('site_urls'))
//{
// $siteUrlsBefore = $site->getUrls();
// $siteUrls = array();
// if(is_array($siteUrlsBefore))
// {
// foreach($siteUrlsBefore as $url)
// {
// $url = trim($url);
// if( array_search( $url, $siteUrls) === false
// && !empty($url) )
// {
// $siteUrls[] = $url;
// }
// }
// }
// // save array of site urls in the cookie
// $GLOBALS['cookie']->setVar('site_urls', $siteUrls);
//}
/*
* site info
*/
//if(!$siteInfo = $GLOBALS['cookie']->getVar('site_info'))
//{
// $siteInfo = $site->getInfo();
//
// // save array of site urls in the cookie
// $GLOBALS['cookie']->setVar('site_info', $siteInfo);
//}
$logo = $site->getLogo();
$siteParams = $site->getParams();
$pageUrl = getRequestVar('url', '', 'string');
if ($pageUrl == "") {
// May be it is a bot !!
printDebug("No url : may be it's a bot ! So we don't save this visit !");
redirectToUrlIfNecessary();
loadImage($logo, $idSite);
exit();
}
// After modif js where we remove all before // in url
// We add http: to not have error in parse_url
if (substr($pageUrl, 0, 2) == "//") {
$pageUrl = "http:".$pageUrl;
}
/*
// Verify that url is in your site
$trouve = false;
foreach($siteUrls as $url)
{
$posInUrl = strpos($pageUrl, $url);
$trouve = ($posInUrl == 0);
}
if (! $trouve) {
printDebug("Url is not ok !");
redirectToUrlIfNecessary();
loadImage($logo, $idSite);
exit();
}
*/
/**
* exit if visitor is cookie excluded from the stats
*/
if(isset($_COOKIE[COOKIE_NAME_NO_STAT.$site->getId()]))
{
printDebug("Excluded from stats with the cookie!");
redirectToUrlIfNecessary();
loadImage($logo, $idSite);
}
/*
* page variables
*/
$a_vars = getRequestVar('a_vars', array(), 'array');
/*
* visitor config, as saved in the database
*/
$userAgent = secureVar(@$_SERVER['HTTP_USER_AGENT']);
$os = getOs($userAgent);
$a_browser = getBrowserInfo($userAgent);
$resolution = getRequestVar('res', 'unknown', 'string');
$colorDepth = getRequestVar('col', 32, 'numeric');
$browserLang = secureVar(@$_SERVER['HTTP_ACCEPT_LANGUAGE']);
$localTime = getRequestVar('h',date("H"),'numeric').':'.
getRequestVar('m',date("i"),'numeric').':'.getRequestVar('s',date("s"),'numeric');
// assign pageCategory default value of the parse_url::path?query
$pageUrlParamsProcessed = processParams($pageUrl, $siteParams);
// fix add site.com because else parse_url bugs with ':' in query string
if(!ereg('^http://',$pageUrlParamsProcessed))
{
$urlParse = parse_url('http://site.com'.$pageUrlParamsProcessed);
}
else
{
$urlParse = parse_url($pageUrlParamsProcessed);
}
if(isset($urlParse['path']))
{
$pageNameDefault = substr($urlParse['path'], 1);
}
if(isset($urlParse['query']))
{
$pageNameDefault .= '?'.$urlParse['query'];
}
if( (!isset($pageNameDefault)
|| strcmp($pageNameDefault, '')===0)
&& isset($urlParse['host'])
)
{
$pageNameDefault = DEFAULT_PAGE_NAME;
}
else if(!isset($pageNameDefault))
{
$pageNameDefault = null;
}
printDebug("PageNameDefault : " . $pageNameDefault);
// stripslashed because otherwise pageName if value is pageNameDefault is slashed twice
$pageCompleteName = utf8_encode(getRequestVar('pagename' ,
stripslashes(html_entity_decode($pageNameDefault))
)
);
$pageCompleteName = str_replace(array("\n", "\r"), '', $pageCompleteName);
$pageCompleteName = str_replace(array("?"), '', $pageCompleteName);
if ($typeTag != "") {
$pageCompleteName = $typeTag.":".$pageCompleteName;
}
// works only on 'path' of this url because the query may contain delimiter !
$file = '';
//if(substr($pageCompleteName, 0, 5) === PREFIX_FILES)
if(isPrefixTag ($pageCompleteName))
{
// $file = PREFIX_FILES;
$file = getPrefixTag($pageCompleteName);
}
printDebug("<br>Page complete name:".$pageCompleteName);
$urlParse = parse_url('http://site.com/'.$pageCompleteName);
$pageCompleteNamePath = substr($urlParse['path'],1);
$lastDelimiter = strrpos($pageCompleteNamePath, CATEGORY_DELIMITER);
printDebug("<br>Page name complete path:".$pageCompleteNamePath);
printDebug("<br>Pos last delimiter : $lastDelimiter");
if($lastDelimiter !== false)
{
// in the $pageCompleteName "g1>g2>page" select only "g1>g2"
$pageCategory = substr($pageCompleteNamePath, 0, $lastDelimiter);
// $pageCategory = str_replace( PREFIX_FILES, '', $pageCategory);
$tabTag = split(",", PREFIX_ALL_TAG);
foreach ($tabTag as $info) {
$pageCategory = str_replace($info, '', $pageCategory);
}
if($pageCategory == '/'
|| $pageCategory == ' '
|| $pageCategory == '+'
|| $pageCategory == '-'
|| $pageCategory == '"'
|| $pageCategory == '\''
)
{
$pageCategory = '';
}
// in the $pageCompleteName "g1>g2>page" select only "page"
// if pageCompleteNamePath bug when all variables recorded, no pagename, only save index.php
$pageName = $file . substr($pageCompleteName, $lastDelimiter + 1);
}
else
{
$pageCategory = '';
$pageName = $pageCompleteName;
}
//var_dump($pageCategory);exit;
// concerning names of pages in subgroups like /g1/g2/g3/ without page names
if(strcmp($pageName, '')===0)
{
$pageName = DEFAULT_PAGE_NAME;
}
printDebug('<br>URL : '.$pageUrl);
printDebug('<br>typeTag : '.$typeTag);
printDebug('<br>pageName : '.$pageName);
printDebug('<br>pageCategory : '.$pageCategory);
printDebug('<br>a_vars : '); printDebug($a_vars);
printDebug('<br>referer : '); printDebug($refererUrl);
printDebug('<br>flash : '.$flash);
printDebug('<br>director : '.$director);
printDebug('<br>quicktime : '.$quicktime);
printDebug('<br>real player : '.$realPlayer);
printDebug('<br>windows media : '.$windowsMedia);
printDebug('<br>cookie : '.$cookieAccept);
printDebug('<br>PDF : '.$pdf);
printDebug('<br>java : '.$java);
printDebug('<br>javascript : '.$javascript);
printDebug('<br>referer Url : '.$refererUrl);
printDebug('<br>id site : '.$idSite);
//printDebug('<br>site Urls : '); printDebug($siteUrls);
//printDebug('<br>site Info : '); printDebug($siteInfo);
printDebug('<br>user Agent : '.$userAgent);
printDebug('<br>os : '.$os);
printDebug('<br>browser : '.$a_browser['longName']);
printDebug('<br>resolution : '.$resolution);
printDebug('<br>color : '.$colorDepth);
/**
* other information
*/
$todayDate = date("Y-m-d");
/**
* try to recognize the visitor, with or without cookie
* who said we are very strong ?
*/
// last_visit = last visit timestamp
// idcookie = id cookie
printDebug("<br><strong>Try to recognize the visitor...</strong><br>");
function saveCountInFile( $fileName )
{
$count = 0;
$fileName = './count/'.$fileName;
if(is_file($fileName))
{
include($fileName);
if(isset($count) && is_integer($count) && $count != 0)
{
saveConfigFile( $fileName, $count+1, "count");
}
}
}
if(TRACE_IN_FILES) saveCountInFile( 'p_total' );
$timeDiffRef = DEFAULT_TIME_PAGE;
// does phpmyvisites cookie exist ?
if($GLOBALS['cookie']->isDefined())
{
// yes, known visitor
$idVisit = $GLOBALS['cookie']->getVar('idvisit');
$idCookie = $GLOBALS['cookie']->getVar('idcookie');
$lastVisit = $GLOBALS['cookie']->getVar('last_visit_time');
$serverTime = $GLOBALS['cookie']->getVar('server_time');
$serverDate = $GLOBALS['cookie']->getVar('server_date');
$idPageRef = $GLOBALS['cookie']->getVar('idpage_ref');
if(TRACE_IN_FILES) saveCountInFile( 'p_cookie' );
if(DEBUG)
printDebug("<br>We know the visitor (thanks to his cookie).
<br>He has idvisit = $idVisit and went last time on
".getTimeForDisplay($lastVisit)."<br>");
}
else
{
printDebug("=>We can't find the cookie...<br>");
if(TRACE_IN_FILES) saveCountInFile( 'p_non_cookie' );
// compute IP
$ip = getIp();
$ip2long = ip2long($ip);
exitIfIpExcluded($ip2long, $logo, $site);
$serverDate = $todayDate;
$tryPutCookie = true;
//edit 2.2RC3 now we check all the time, because if someone refresh the home page 100 times
// and didn't accept cookies, it was counted 100 visitors!!
/*
if($site->isUrlIn($refererUrl))
{
printDebug("=> Referer Is in the site ! try to catch the visitor...<br>");
if(TRACE_IN_FILES) saveCountInFile( 'p_ref_url_in' );
}
*/
$md5Config = md5( $os . serialize($a_browser) . $resolution . $colorDepth . $pdf
. $flash . $java . $javascript . $director . $quicktime . $realPlayer . $windowsMedia . $cookieAccept
. $ip2long . $browserLang);
// does the config (os+browser+resolution+color_depth) and the IP match any visitor ?
$r = query("SELECT idvisit, idcookie, TIME_TO_SEC(last_visit_time),
TIME_TO_SEC(server_time), exit_idpage
FROM ".T_VISIT."
WHERE server_date = '$todayDate'
AND idsite = '$idSite'
AND md5config = '$md5Config'
ORDER BY last_visit_time DESC
LIMIT 1");
if(mysql_num_rows($r)>0)
{
// yes
$r = mysql_fetch_row($r);
$idVisit = $r[0];
$idCookie = $r[1];
$lastVisit = $r[2];
$serverTime = $r[3];
$idPageRef = $r[4];
if(TRACE_IN_FILES) saveCountInFile( 'p_ref_url_in_found' );
printDebug("=> We found the MD5CONFIG of visitor so he is known<br>");
}
// case we didn't match any visitor
if(!isset($idVisit))
{
// no, new visitor
$newVisitor = true;
if(TRACE_IN_FILES) saveCountInFile( 'p_ref_not_found' );
printDebug("=> It's definitely a new visitor<br>");
}
}
if(isset($lastVisit)
&& $lastVisit !== false
&& $lastVisit < todayTime() // case the lastVisit value has been spoiled
)
{
$timeDiffRef = todayTime() - $lastVisit;
// case the lastVisit value has been spoiled (BIS)
$timeDiffRef = min($timeDiffRef, TIME_ONE_VISIT);
}
if(!isset($idPageRef)
|| $idPageRef === false )
{
$idPageRef = 0;
}
else
{
printDebug("We know its page ref id=$idPageRef and he stayed on it $timeDiffRef seconds <br>");
}
/**
* Current visitor is a new visitor or an old one
* but without cookie, so we put a cookie
*/
if(isset($newVisitor) || isset($tryPutCookie))
{
// record it and set the cookie
$idCookie = $GLOBALS['cookie']->put(isset($idCookie)?$idCookie:'');
// case : visitor known but cookie not set during his first page views...
if(isset($idVisit))
{
$GLOBALS['cookie']->setVar('idvisit', $idVisit);
}
else
{
$lastVisit = todayTime();
}
}
/**
* Visitor is known, we now look if it's a new visit or not
*/
// is the visit older than 30 minutes ?
if(!isset($newVisitor))
{
if(DEBUG)
printDebug("(idvisit = $idVisit, ".getTimeForDisplay($serverTime)." | now : " .
todayTime()." :: first page last time : $serverTime)");
if ($serverDate == date("Y-m-d")
&& ($lastVisit > (todayTime() - TIME_ONE_VISIT))
)
{
// yes, new visit
$GLOBALS['cookie']->setVar('last_visit_time', todayTime());
$knownVisit = true;
printDebug("<br><b>=>Visit is known on date : $serverDate</b><br>");
}
else
{
printDebug("=>Last visit is too old <b>==> New visit</b><br>");
$returningVisitor = 1;
}
}
else
{
printDebug("<br><b>=>New Visitor also means new visit</b><br>");
}
/**
* Current visit is a known visit
*/
// save current page, etc.
if(isset($knownVisit) && $knownVisit)
{
// we know
// * $lastVisit
// * $idVisit
// * $idCookie
// update last_visit_time
printDebug("==> This is a visit known... we update the data <br>");
// do it first because we need idpage for visit info insert
//print("$pageName <br> $pageUrl <br> $pageCategory ");exit;
$a_idPages = recordDbPage($pageName, $pageUrlParamsProcessed, $pageCategory, false);
$idPage = $a_idPages[0];
// save current page & url & variables information
$idLink_vp = recordDbInfoPage($idVisit, $idPage, $idPageRef, $timeDiffRef, $a_vars);
$total_time = DEFAULT_TIME_PAGE + todayTime() - $serverTime;
// update last_visit_time & total_pages & c_total_time
$r = query("UPDATE ".T_VISIT."
SET last_visit_time = CURRENT_TIME(),
total_pages = total_pages + 1,
total_time = '$total_time',
exit_idpage = '$idPage'
WHERE idvisit = '$idVisit'
LIMIT 1");
}
/*
* Current visit a new visit
*/
// now we know the visitor and its idcookie
// save new visit
else
{
printDebug("==> This is a new visit, we create datas in the database when necessary<br>");
if(!isset($ip) || !isset($ip2long))
{
$ip = getIp();
$ip2long = ip2long($ip);
exitIfIpExcluded($ip2long, $logo, $site);
}
$hostExt = getHostnameExt(getHost($ip));
printDebug('<br>ip : '.$ip);
printDebug('<br>hostname : '.$hostExt);
$serverDate = date("Y-m-d");
$serverTime = date("H:i:s");
$country = getCountry($hostExt, $browserLang);
if($country == 'gb')
{
$country = 'uk';
}
$continent = getContinent($country);
if(strlen($refererUrl)===0)
{
$refererUrl = 'NULL';
}
else
{
$refererUrl = "'".$refererUrl."'";
}
// do it first because we need idpage for visit info insert
$a_idPages = recordDbPage($pageName, $pageUrlParamsProcessed, $pageCategory, true);
$idPageUrl = $a_idPages[1];
$idPage = $a_idPages[0];
$md5Config = md5( $os . serialize($a_browser) . $resolution . $colorDepth . $pdf
. $flash . $java . $javascript . $director . $quicktime . $realPlayer . $windowsMedia . $cookieAccept
. $ip2long . $browserLang);
// save visitor information
$r = query("INSERT INTO ".T_VISIT."
(idsite, idcookie, returning, last_visit_time, server_date, server_time, md5config,
referer, os, browser_name, browser_version, resolution, color_depth,
pdf, flash, java, javascript, director, quicktime, realplayer, windowsmedia, cookie,
local_time, ip, hostname_ext, browser_lang, country, continent,
total_pages, total_time, entry_idpage, entry_idpageurl, exit_idpage)
VALUES ('$idSite', '$idCookie', '$returningVisitor', CURRENT_TIME(),
'$serverDate', '$serverTime', '$md5Config',
$refererUrl, '$os', '".$a_browser['shortName']."',
'".$a_browser['version']."', '$resolution', '$colorDepth',
'$pdf', '$flash','$java', '$javascript', '$director', '$quicktime', '$realPlayer', '$windowsMedia', '$cookieAccept',
'$localTime','$ip2long', '$hostExt', '$browserLang', '$country', '$continent',
1, '".DEFAULT_TIME_PAGE ."', '$idPage', '$idPageUrl', '$idPage')
");
$idVisit = mysql_insert_id();
// save page view and URL and variables
recordDbInfoPage($idVisit, $idPage, $idPageRef, $timeDiffRef, $a_vars);
// save idvisit
$GLOBALS['cookie']->setVar('idvisit', $idVisit);
$GLOBALS['cookie']->setVar('last_visit_time', todayTime());
$GLOBALS['cookie']->setVar('server_time', todayTime());
$GLOBALS['cookie']->setVar('server_date', $serverDate);
}
$GLOBALS['cookie']->setVar('idpage_ref', $idPage);
$GLOBALS['cookie']->save();
printDebug("<br><b>Next cookie should be :</b>");
printDebug($GLOBALS['cookie']->getContent());
// footer
if(PRINT_QUERY_COUNT)
printQueryCount();
if(PRINT_TIME)
printTime();
if(SAVE_DB_LOG)
{
recordDbQueryCount($idSite);
}
require_once INCLUDE_PATH . "/core/include/common.functions.php";
$crontabFile = INCLUDE_PATH . "/config/crontab.php";
if(is_file($crontabFile))
{
include($crontabFile);
}
if( WEB_CRONTAB
&& is_writable( $crontabFile)
&&
(
// if crontab doesn't exist in the file or the file doesn't exist
// or if the last try was before today
( !isset($crontab)
|| $crontab['date_last_success'] != getDateFromTimestamp(time())
)
&&
(
!is_file($crontabFile)
|| ( isset($crontab)
&& $crontab['time_last_try'] < time() - TIME_TO_WAIT_FOR_PARALLEL_ARCHIVE // every 5min
)
)
)
)
{
$crontab['time_last_try'] = time();
$crontab['date_last_success'] = '2000-12-31';
saveConfigFile( $crontabFile, $crontab, "crontab");
printDebug('==========================<br>
CRONTAB BEGIN/ <br>
==========================<br>
');
require_once INCLUDE_PATH . '/core/include/PmvConfig.class.php';
require_once INCLUDE_PATH . '/core/include/ApplicationController.php';
$r =& Request::getInstance();
$r->setModuleName('send_mail');
$r->setCrontabAllowed();
ApplicationController::init();
printDebug('==========================<br>
CRONTAB END/ <br>
==========================<br>
');
$crontab['date_last_success'] = getDateFromTimestamp(time());
saveConfigFile( $crontabFile, $crontab, "crontab");
}
$db->close();
redirectToUrlIfNecessary();
loadImage($logo, $idSite);
// flush content for display
if(DEBUG)
ob_end_flush();
?>
Code4
<?php
/*
* phpMyVisites : website statistics and audience measurements
* Copyright (C) 2002 - 2006
* http://www.phpmyvisites.net/
* phpMyVisites is free software (license GNU/GPL)
* Authors : phpMyVisites team
*/
// $Id: version.php 232 2007-07-06 09:31:19Z matthieu_ $
define('PHPMV_VERSION', '2.3');
?>
Aidez moi s'il vous plait
Cordialement à vous
Code1
<?php
/*
* phpMyVisites : website statistics and audience measurements
* Copyright (C) 2002 - 2006
* http://www.phpmyvisites.net/
* phpMyVisites is free software (license GNU/GPL)
* Authors : phpMyVisites team
*/
// $Id: config.inc.php 236 2007-11-04 15:04:08Z matthieu_ $
/**
* Maybe you want to edit these values (but be careful!)
*/
define('TIME_BEFORE_NEW_DAY_ARCHIVE', 10);//3600 * 3); // time before the current day is again archived when stats visited
define('INTERNAL_STATS', false); // define if phpmyvisites application statistics are saved
define('INTERNAL_CLICKHEAT', false); // define if phpmv app clicks are logged
define('SMARTY_DEBUG', false); // define if smarty is in debug mode (means CACHE activated, template build on each page, etc.)
define('DEFAULT_SITE', 1); // id of the site that is displayed after login (or -1 for summary)
define('CURRENT_DAY_SIMPLE_ARCHIVE', false); // define if current day archive is simplified or not
define('CURRENT_PERIOD_SIMPLE_ARCHIVE', false); // define if temp period archive is simplified or not
define('DEFAULT_DAY_TODAY', false); // is the default day today or yesterday?
define('ALL_POPULATION', false); // include all population or not
define('WEB_CRONTAB', true); // defines if the automatic crontab is activated or not (launched by the first visitor of each day). Must be desactivated if you setted a real crontab with the RSS feed (see FAQ)
define('SECURE_SERVER_HTTPS', false); // if true, the URLs constructed will be prefixed by https instead of http
define('COMPRESS_DB_DATA', true); // try to compress data before Database recording ? (can slow the process)
define('CATEGORY_DELIMITER', '/'); // category delimiter. Use '/' to make your categories automatically
define('TIME_TO_WAIT_FOR_PARALLEL_ARCHIVE', 40 * 60); // seconds to wait before try a new archive when a parallel archiving process is detected (also used in crontab task)
define('NB_IPS_RANGE_AVAILABLE', 10); // number of input for ip range exclude in the administration area
define('NB_URLS_ALIAS_AVAILABLE', 5); // number of input for urls alias in the administration area
define('NB_ELEMENTS_TO_DISPLAY', 10); // number of elements to display in tables (search engines, keywords, etc.)
define('DEFAULT_PAGE_NAME', 'index'); // default page name, when is like toto.com/ or toto.com/group1/group2/
define('PARAM_URL_PARTNER', 'pmv_pid'); // param name for identifying partner
define('PARAM_URL_NEWSLETTER', 'pmv_nid'); // param name for identifying newsletter
define('PREFIX_FILES', 'FILE:'); // prefix for files in the Javascript code Ex : pagename = 'FILE:group1/group2/group3/documentation.pdf'
define('PREFIX_ALL_TAG', 'FILE:'); // Liste of prefix for files,rss and pocast in the Javascript code Ex : pagename = 'FILE:group1/group2/group3/documentation.pdf'
define('MAX_DISTINCT_ELEMENTS', 300); // max elements (ex. number of keywords saved, number of distinct ISP)
define('MAX_DISTINCT_DETAILS_ELEMENTS', 300); // max distinct elements for details table (ex. number of keywords for a specific search engine)
define('MAX_DISTINCT_INTEREST_ELEMENTS', 150); // max elements used in Interest analysis
define('PMV_REWRITE_MODE', 'PEAR_REQUEST'); // [PEAR_REQUEST, URLREWRITE], PEAR_REQUEST : Use PEAR plugin with fsockopen (can be used if url is on the same server or if fsockopen is authorised with others servers), URLREWRITE (default) : rewrite url to the file
define('NEWSLETTER_FORCE_CREATE', false); // If phpmv recieve a call of a newsletter and if not exists : create the newsletter true ! error message : false
define('NEWSLETTER_CREATE_NAME', 'Newsletter : '); // Begining of the name when you force newsletter creation
define('NEWSLETTER_ID_MAX_AUTO', 100); // Max newsletter id create automatically (-1 no limit)
/**
* You shouldn't edit the values after this comment
*/
define('CACHE_SMARTY', 60*60*48); // define smarty cache lifetime
define('DEFAULT_TIME_PAGE', 20); // 20 sec per page if there isn't any page following (time standard!)
define('TIME_SLOW_QUERY', 0.05); // slow queries are loggued into database
define('PERCENT_MAX', 1000); // percent maximum born
define('THEME_DEFAULT', 'default'); // default theme directory
define('THEME_ADMIN', 'default'); // admin theme directory
define('STORE_PAG_ARRAY_IN_FILE', false); // store big page arrays in files. Increase performance for stat report, but uses disk space
define('NB_DAYS_FOR_RSS_ITEMS', 3); // days to compute to syndicate in the RSS sites (to multiply by number of sites ! be careful !)
define('ADMINISTRATOR_MAIL', 'phpmyvisites@gmail.com'); // mail that appears in the mail sent from phpmyvisites
define('CACHE_RSS_LIFETIME', 3600); // lifetime of the rss syndication file cache
define('CACHE_MAIL_LIFETIME', 3600); // lifetime of the mail file cache
define('PHP_VERSION_NEEDED', '4.3'); // version of php needed for phpmyvisites to work correctly
define('MEMORY_LIMIT', 16); // good value for memory limit
define('DEFAULT_MODULE', 'view_visits'); // name of the default module loaded
define('COOKIE_PMVLOG_NAME', 'pmv_ck_'); // cookie name for log
define('COOKIE_NAME_VIEW', 'pmv_ck_view_conf'); // cookie name for stats view
define('COOKIE_NAME_SESSION', 'pmv_ck_session'); // cookie name for session
define('COOKIE_NAME_NO_STAT', 'pmv_ck_no_stat'); // cookie name for session
define('MAX_LENGTH_ONE_VALUE_IN_COOKIE', 300); // length in byte
define('TIME_ONE_VISIT', 30*60); // time max for one visit (the time is normed) in seconds
define('MAX_LENGTH_JAVASCRIPT_A_VARS_ARRAY', 200); // max length for a variable value in the "var a_vars" javascript array in javascript code
define('COOKIE_EXPIRE', 86400*365*10); // time after which the cookie will expire
define('SECURE_TIME_BEFORE_NEW_ARCHIVE', 20); // time added to each archive's valid time for current day archives. It is a security to try to use the same archives for the graphs on the page
// For PHPMV_STAT_*, INTERNAL_STATS must be set to true
define('PMV_STAT_ID_SITE', 1); // Id of site where phpmv site must be saved (-1) : So create a site in phpmyvistes and set here, the id of this site
define('PMV_STAT_SAVE_USER', true); // true to have login name in variable of page viewed
// Other
if(!defined('DEBUG')) define('DEBUG', false);
define('DEFAULT_ACTION', false);
error_reporting( E_ALL );
if(DEBUG)
{
define('PRINT_TIME', false);
define('PRINT_QUERY_COUNT', true);
define('SAVE_DB_LOG', true);
define('PRINT_QUERY', true);
}
else
{
define('PRINT_QUERY', false);
define('PRINT_TIME', false);
define('PRINT_QUERY_COUNT', false);
define('SAVE_DB_LOG', false);
}
// relative directories
define('DIR_IMG_THEMES', './themes/'.THEME_DEFAULT.'/images/');
define('DIR_IMG_BROWSERS', './images/browsers');
define('DIR_IMG_OS', './images/os');
define('DIR_IMG_PLUGINS', './images/plugins');
define('DIR_IMG_LOGOS', './images/logos');
define('DIR_IMG_COUNTRIES_FLAGS', './images/countries_flags');
define('DIR_IMG_SCREENS', './images/screens');
define('DIR_IMG_SEARCH_ENGINES', './images/search_engines');
// absolute directories
define('LANGS_PATH', INCLUDE_PATH . '/langs');
define('DIR_IMG_MAPS', INCLUDE_PATH . '/images/maps');
define('DIR_CACHE_RSS', INCLUDE_PATH . '/datas/cache_lite/');
define('DIR_CACHE_MAIL', INCLUDE_PATH . '/datas/cache_lite/');
define('FONTS_PATH', INCLUDE_PATH . '/libs/artichow/font/');
// xhtml
define('HREF_DOC_OPEN', "<strong><a href='http://www.phpmyvisites.us/documentation/'>");
define('HREF_DOC_CLOSE', "</a></strong>");
define('HREF_FORUMS', "<strong><a href=\"http://www.phpmyvisites.us/forums/\" alt=\"{'head_titre'|translate}\" title=\"{'head_titre'|translate}\">http://www.phpmyvisites.us/forums/</a></strong>");
define('URL_SITE_EXAMPLE', 'http://www.site.com');
define('IP_EXAMPLE', 'A.B.C.D or A.B.C.x...');
define('GET_LIST_EXAMPLE', '<i>id;data;page</i>');
// archiving
define('REF_TYPE_SEARCH_ENGINE', 1);
define('REF_TYPE_SITE', 2);
define('REF_TYPE_PARTNER', 3);
define('REF_TYPE_NEWSLETTER', 4);
define('REF_TYPE_DIRECT_ENTRY', 5);
define('DB_ARCHIVES_PERIOD_DAY', 1);
define('DB_ARCHIVES_PERIOD_WEEK', 2);
define('DB_ARCHIVES_PERIOD_MONTH', 3);
define('DB_ARCHIVES_PERIOD_YEAR', 4);
define('DB_ARCHIVES_PERIOD_MISC_PERIOD', 5);
define('DB_ARCHIVES_DONE', 1);
define('DB_ARCHIVES_TEMP', 2);
define('DB_ARCHIVES_FAIL', 3);
define('ARRAY_INDEX_COUNT', 1);
define('ARRAY_INDEX_PAGE_NAME', 2);
define('ARRAY_INDEX_IDPAGE', 3);
define('ARRAY_INDEX_IDCATEGORY', 4);
define('ARRAY_INDEX_LEVEL', 5);
define('ARRAY_INDEX_IDPARENT', 6);
define('ARRAY_INDEX_TIME_TOTAL' , 7);
define('ARRAY_INDEX_ENTRYPAGE', 8);
define('ARRAY_INDEX_EXITPAGE', 9);
define('ARRAY_INDEX_VARS', 10);
define('ARRAY_INDEX_TYPE', 11);
define('ARRAY_INDEX_PAGES_VISIT_ONEPAGE', 12);
define('ARRAY_INDEX_PAGES_COUNT', 13);
define('ARRAY_INDEX_RETURNING_COUNT', 14);
define('ARRAY_INDEX_NEW_COUNT', 15);
define('ARRAY_INDEX_VAR_COUNT', 1);
define('ARRAY_INDEX_VAR_VALUE', 2);
define('ARRAY_TYPE_PAGE', 1);
define('ARRAY_TYPE_FILE', 2);
define('STAT_PAGE_PER_VISIT', 0);
define('STAT_PAGE_PER_VISIT_SIGNIFICANT', 1);
define('STAT_ONE_PAGE_RATE', 2);
define('STAT_TIME_PER_VISIT', 3);
define('DATE_NORMAL', 0);
define('DATE_GRAPH', 1);
define('DATE_GRAPH_LONG_AXIS', 2);
// Require
require_once INCLUDE_PATH."/version.php";
require_once INCLUDE_PATH."/core/datas/browserFamilies.php";
require_once INCLUDE_PATH."/core/datas/browsers.php";
require_once INCLUDE_PATH."/core/datas/countryList.php";
require_once INCLUDE_PATH."/core/datas/ispCountryList.php";
require_once INCLUDE_PATH."/core/datas/osLists.php";
require_once INCLUDE_PATH."/core/datas/pagesGap.php";
require_once INCLUDE_PATH."/core/datas/searchEngines.php";
require_once INCLUDE_PATH."/core/datas/timeGap.php";
require_once INCLUDE_PATH."/core/datas/fontList.php";
/**
* Simple function to replicate PHP 5 behaviour
*/
function getMicrotime()
{
list($usec, $sec) = explode(" ", microtime());
return ((float)$usec + (float)$sec);
}
$GLOBALS['time_start'] = getMicrotime();
$GLOBALS['query_count'] = 0; // number of queries of the page
$GLOBALS['a_content'] = array(); // cookie content
$GLOBALS['header_message_tpl'] = '';
$GLOBALS['header_error_message_tpl'] = '';
?>
Code2
<?php
/*
* phpMyVisites : website statistics and audience measurements
* Copyright (C) 2002 - 2006
* http://www.phpmyvisites.net/
* phpMyVisites is free software (license GNU/GPL)
* Authors : phpMyVisites team
*/
// $Id: index.php 220 2007-06-27 10:01:07Z matthieu_ $
define('INCLUDE_PATH', '.');
define('PLUGINS_PATH', INCLUDE_PATH."/plugins/");
// For profiling, XDEBUG 2.x generates .out to be analysed with KcacheGrind or WinCacheGrind
@set_time_limit(0);
@error_reporting(E_ALL);
require_once INCLUDE_PATH . '/core/include/PmvConfig.class.php';
require_once INCLUDE_PATH . '/core/include/ApplicationController.php';
ApplicationController::init();
if( Request::moduleIsNotAStrangeModule() )
printTime('EOF', PRINT_TIME);
?>
Code3
<?php
/*
* phpMyVisites : website statistics and audience measurements
* Copyright (C) 2002 - 2006
* http://www.phpmyvisites.net/
* phpMyVisites is free software (license GNU/GPL)
* Authors : phpMyVisites team
*/
// $Id: phpmyvisites.php 218 2007-06-02 07:15:48Z cmil $
define('SAVE_STAT', true ); // default true
define('LOOK_FOR_COOKIE', true); // default true
define('DEBUG', false); // default false
define('TRACE_IN_FILES', false); // default false
define('INCLUDE_PATH', '.');
define('PRINT_COOKIE_CONTENT', false); // debug only : display cookie content for the current domain
define('PRINT_ALL_COOKIES_CONTENT', false); // debug only : display all pmv cookies for the current domain
// TODO dans le test du referer appartient au site, testez également en plus
// des sitesUrls le host de l'url de la page current sur le host de l'url ref
@ignore_user_abort(true);
@set_time_limit(0);
@error_reporting(E_ALL);
require_once INCLUDE_PATH."/core/include/Lang.class.php";
require_once INCLUDE_PATH.'/config.inc.php';
require_once INCLUDE_PATH."/core/include/Logs.functions.php";
require_once INCLUDE_PATH."/core/include/common.functions.php";
require_once INCLUDE_PATH."/core/include/Cookie.class.php";
require_once INCLUDE_PATH."/core/include/Site.class.php";
require_once INCLUDE_PATH."/core/include/PmvConfig.class.php";
if(!SAVE_STAT)
{
redirectToUrlIfNecessary();
// else, display pixel
$img = INCLUDE_PATH . "/images/logos/pixel.gif";
header("Content-type: image/gif");
readfile($img);
exit;
}
// hack for not to show tables (because getCurrentCompleteUrl bugs
// with url containing another url in one parameter)
$GLOBALS['currentModuleIsLogModule'] = true;
$c =& PmvConfig::getInstance();
$db =& Db::getInstance();
$db->connect();
// when no get specified, display a marketing page :)
if(sizeof($_GET) === 0)
{
require_once INCLUDE_PATH."/core/include/Lang.class.php";
$l =& Lang::getInstance();;
displayPageWhenEmptyGet();
exit;
}
if(DEBUG)
{
require_once INCLUDE_PATH."/core/include/functions.php";
}
if(DEBUG)
ob_start();
// - imprimer doc mysql "optimisation"
/*
* Get page & visitor information
*/
$idSite = getRequestVar('id', null, 'numeric');
$GLOBALS['cookie'] = new Cookie( COOKIE_PMVLOG_NAME . $idSite);
if(LOOK_FOR_COOKIE && $GLOBALS['cookie']->isDefined())
{
printDebug("<b>Cookie at the beginning (size : ".$GLOBALS['cookie']->getSize()." bytes)</b> :<br>");
printDebug($GLOBALS['cookie']->get());
$returningVisitor = 1;
}
else
{
$returningVisitor = 0;
printDebug("<b>Cookie not found !</b><br><br>");
}
$flash = getRequestVar('flash', 0, 'numeric');
$director = getRequestVar('director', 0, 'numeric');
$quicktime = getRequestVar('quicktime', 0, 'numeric');
$realPlayer = getRequestVar('realplayer', 0, 'numeric');
$windowsMedia = getRequestVar('windowsmedia', 0, 'numeric');
$cookieAccept = getRequestVar('cookie', 0, 'numeric'); // Don't name $cookie because conflict with $GLOBALS['cookie']
$pdf = getRequestVar('pdf', 0, 'numeric');
$java = getRequestVar('java', -1, 'numeric');
if ($java == -1) {
$javascript = 0;
$java = 0;
}
else {
$javascript = 1;
}
$refererUrl = getRequestVar('ref', '');
$typeTag = getRequestVar('type', "", 'string');
$site = new Site($idSite);
// debug cookie
if(PRINT_ALL_COOKIES_CONTENT)
{
require_once INCLUDE_PATH . "/core/include/DataModel.class.php";
$sitesId = $site->getSitesId();
foreach($sitesId as $sid)
{
$c = new Cookie( COOKIE_PMVLOG_NAME . $sid);
print($c->toString());
}
exit;
}
else if(PRINT_COOKIE_CONTENT)
{
print($GLOBALS['cookie']->toString());
exit;
}
/*
* site urls
*/
// commented in 2.3b3 because its actually not used
//if(!$siteUrls = $GLOBALS['cookie']->getVar('site_urls'))
//{
// $siteUrlsBefore = $site->getUrls();
// $siteUrls = array();
// if(is_array($siteUrlsBefore))
// {
// foreach($siteUrlsBefore as $url)
// {
// $url = trim($url);
// if( array_search( $url, $siteUrls) === false
// && !empty($url) )
// {
// $siteUrls[] = $url;
// }
// }
// }
// // save array of site urls in the cookie
// $GLOBALS['cookie']->setVar('site_urls', $siteUrls);
//}
/*
* site info
*/
//if(!$siteInfo = $GLOBALS['cookie']->getVar('site_info'))
//{
// $siteInfo = $site->getInfo();
//
// // save array of site urls in the cookie
// $GLOBALS['cookie']->setVar('site_info', $siteInfo);
//}
$logo = $site->getLogo();
$siteParams = $site->getParams();
$pageUrl = getRequestVar('url', '', 'string');
if ($pageUrl == "") {
// May be it is a bot !!
printDebug("No url : may be it's a bot ! So we don't save this visit !");
redirectToUrlIfNecessary();
loadImage($logo, $idSite);
exit();
}
// After modif js where we remove all before // in url
// We add http: to not have error in parse_url
if (substr($pageUrl, 0, 2) == "//") {
$pageUrl = "http:".$pageUrl;
}
/*
// Verify that url is in your site
$trouve = false;
foreach($siteUrls as $url)
{
$posInUrl = strpos($pageUrl, $url);
$trouve = ($posInUrl == 0);
}
if (! $trouve) {
printDebug("Url is not ok !");
redirectToUrlIfNecessary();
loadImage($logo, $idSite);
exit();
}
*/
/**
* exit if visitor is cookie excluded from the stats
*/
if(isset($_COOKIE[COOKIE_NAME_NO_STAT.$site->getId()]))
{
printDebug("Excluded from stats with the cookie!");
redirectToUrlIfNecessary();
loadImage($logo, $idSite);
}
/*
* page variables
*/
$a_vars = getRequestVar('a_vars', array(), 'array');
/*
* visitor config, as saved in the database
*/
$userAgent = secureVar(@$_SERVER['HTTP_USER_AGENT']);
$os = getOs($userAgent);
$a_browser = getBrowserInfo($userAgent);
$resolution = getRequestVar('res', 'unknown', 'string');
$colorDepth = getRequestVar('col', 32, 'numeric');
$browserLang = secureVar(@$_SERVER['HTTP_ACCEPT_LANGUAGE']);
$localTime = getRequestVar('h',date("H"),'numeric').':'.
getRequestVar('m',date("i"),'numeric').':'.getRequestVar('s',date("s"),'numeric');
// assign pageCategory default value of the parse_url::path?query
$pageUrlParamsProcessed = processParams($pageUrl, $siteParams);
// fix add site.com because else parse_url bugs with ':' in query string
if(!ereg('^http://',$pageUrlParamsProcessed))
{
$urlParse = parse_url('http://site.com'.$pageUrlParamsProcessed);
}
else
{
$urlParse = parse_url($pageUrlParamsProcessed);
}
if(isset($urlParse['path']))
{
$pageNameDefault = substr($urlParse['path'], 1);
}
if(isset($urlParse['query']))
{
$pageNameDefault .= '?'.$urlParse['query'];
}
if( (!isset($pageNameDefault)
|| strcmp($pageNameDefault, '')===0)
&& isset($urlParse['host'])
)
{
$pageNameDefault = DEFAULT_PAGE_NAME;
}
else if(!isset($pageNameDefault))
{
$pageNameDefault = null;
}
printDebug("PageNameDefault : " . $pageNameDefault);
// stripslashed because otherwise pageName if value is pageNameDefault is slashed twice
$pageCompleteName = utf8_encode(getRequestVar('pagename' ,
stripslashes(html_entity_decode($pageNameDefault))
)
);
$pageCompleteName = str_replace(array("\n", "\r"), '', $pageCompleteName);
$pageCompleteName = str_replace(array("?"), '', $pageCompleteName);
if ($typeTag != "") {
$pageCompleteName = $typeTag.":".$pageCompleteName;
}
// works only on 'path' of this url because the query may contain delimiter !
$file = '';
//if(substr($pageCompleteName, 0, 5) === PREFIX_FILES)
if(isPrefixTag ($pageCompleteName))
{
// $file = PREFIX_FILES;
$file = getPrefixTag($pageCompleteName);
}
printDebug("<br>Page complete name:".$pageCompleteName);
$urlParse = parse_url('http://site.com/'.$pageCompleteName);
$pageCompleteNamePath = substr($urlParse['path'],1);
$lastDelimiter = strrpos($pageCompleteNamePath, CATEGORY_DELIMITER);
printDebug("<br>Page name complete path:".$pageCompleteNamePath);
printDebug("<br>Pos last delimiter : $lastDelimiter");
if($lastDelimiter !== false)
{
// in the $pageCompleteName "g1>g2>page" select only "g1>g2"
$pageCategory = substr($pageCompleteNamePath, 0, $lastDelimiter);
// $pageCategory = str_replace( PREFIX_FILES, '', $pageCategory);
$tabTag = split(",", PREFIX_ALL_TAG);
foreach ($tabTag as $info) {
$pageCategory = str_replace($info, '', $pageCategory);
}
if($pageCategory == '/'
|| $pageCategory == ' '
|| $pageCategory == '+'
|| $pageCategory == '-'
|| $pageCategory == '"'
|| $pageCategory == '\''
)
{
$pageCategory = '';
}
// in the $pageCompleteName "g1>g2>page" select only "page"
// if pageCompleteNamePath bug when all variables recorded, no pagename, only save index.php
$pageName = $file . substr($pageCompleteName, $lastDelimiter + 1);
}
else
{
$pageCategory = '';
$pageName = $pageCompleteName;
}
//var_dump($pageCategory);exit;
// concerning names of pages in subgroups like /g1/g2/g3/ without page names
if(strcmp($pageName, '')===0)
{
$pageName = DEFAULT_PAGE_NAME;
}
printDebug('<br>URL : '.$pageUrl);
printDebug('<br>typeTag : '.$typeTag);
printDebug('<br>pageName : '.$pageName);
printDebug('<br>pageCategory : '.$pageCategory);
printDebug('<br>a_vars : '); printDebug($a_vars);
printDebug('<br>referer : '); printDebug($refererUrl);
printDebug('<br>flash : '.$flash);
printDebug('<br>director : '.$director);
printDebug('<br>quicktime : '.$quicktime);
printDebug('<br>real player : '.$realPlayer);
printDebug('<br>windows media : '.$windowsMedia);
printDebug('<br>cookie : '.$cookieAccept);
printDebug('<br>PDF : '.$pdf);
printDebug('<br>java : '.$java);
printDebug('<br>javascript : '.$javascript);
printDebug('<br>referer Url : '.$refererUrl);
printDebug('<br>id site : '.$idSite);
//printDebug('<br>site Urls : '); printDebug($siteUrls);
//printDebug('<br>site Info : '); printDebug($siteInfo);
printDebug('<br>user Agent : '.$userAgent);
printDebug('<br>os : '.$os);
printDebug('<br>browser : '.$a_browser['longName']);
printDebug('<br>resolution : '.$resolution);
printDebug('<br>color : '.$colorDepth);
/**
* other information
*/
$todayDate = date("Y-m-d");
/**
* try to recognize the visitor, with or without cookie
* who said we are very strong ?
*/
// last_visit = last visit timestamp
// idcookie = id cookie
printDebug("<br><strong>Try to recognize the visitor...</strong><br>");
function saveCountInFile( $fileName )
{
$count = 0;
$fileName = './count/'.$fileName;
if(is_file($fileName))
{
include($fileName);
if(isset($count) && is_integer($count) && $count != 0)
{
saveConfigFile( $fileName, $count+1, "count");
}
}
}
if(TRACE_IN_FILES) saveCountInFile( 'p_total' );
$timeDiffRef = DEFAULT_TIME_PAGE;
// does phpmyvisites cookie exist ?
if($GLOBALS['cookie']->isDefined())
{
// yes, known visitor
$idVisit = $GLOBALS['cookie']->getVar('idvisit');
$idCookie = $GLOBALS['cookie']->getVar('idcookie');
$lastVisit = $GLOBALS['cookie']->getVar('last_visit_time');
$serverTime = $GLOBALS['cookie']->getVar('server_time');
$serverDate = $GLOBALS['cookie']->getVar('server_date');
$idPageRef = $GLOBALS['cookie']->getVar('idpage_ref');
if(TRACE_IN_FILES) saveCountInFile( 'p_cookie' );
if(DEBUG)
printDebug("<br>We know the visitor (thanks to his cookie).
<br>He has idvisit = $idVisit and went last time on
".getTimeForDisplay($lastVisit)."<br>");
}
else
{
printDebug("=>We can't find the cookie...<br>");
if(TRACE_IN_FILES) saveCountInFile( 'p_non_cookie' );
// compute IP
$ip = getIp();
$ip2long = ip2long($ip);
exitIfIpExcluded($ip2long, $logo, $site);
$serverDate = $todayDate;
$tryPutCookie = true;
//edit 2.2RC3 now we check all the time, because if someone refresh the home page 100 times
// and didn't accept cookies, it was counted 100 visitors!!
/*
if($site->isUrlIn($refererUrl))
{
printDebug("=> Referer Is in the site ! try to catch the visitor...<br>");
if(TRACE_IN_FILES) saveCountInFile( 'p_ref_url_in' );
}
*/
$md5Config = md5( $os . serialize($a_browser) . $resolution . $colorDepth . $pdf
. $flash . $java . $javascript . $director . $quicktime . $realPlayer . $windowsMedia . $cookieAccept
. $ip2long . $browserLang);
// does the config (os+browser+resolution+color_depth) and the IP match any visitor ?
$r = query("SELECT idvisit, idcookie, TIME_TO_SEC(last_visit_time),
TIME_TO_SEC(server_time), exit_idpage
FROM ".T_VISIT."
WHERE server_date = '$todayDate'
AND idsite = '$idSite'
AND md5config = '$md5Config'
ORDER BY last_visit_time DESC
LIMIT 1");
if(mysql_num_rows($r)>0)
{
// yes
$r = mysql_fetch_row($r);
$idVisit = $r[0];
$idCookie = $r[1];
$lastVisit = $r[2];
$serverTime = $r[3];
$idPageRef = $r[4];
if(TRACE_IN_FILES) saveCountInFile( 'p_ref_url_in_found' );
printDebug("=> We found the MD5CONFIG of visitor so he is known<br>");
}
// case we didn't match any visitor
if(!isset($idVisit))
{
// no, new visitor
$newVisitor = true;
if(TRACE_IN_FILES) saveCountInFile( 'p_ref_not_found' );
printDebug("=> It's definitely a new visitor<br>");
}
}
if(isset($lastVisit)
&& $lastVisit !== false
&& $lastVisit < todayTime() // case the lastVisit value has been spoiled
)
{
$timeDiffRef = todayTime() - $lastVisit;
// case the lastVisit value has been spoiled (BIS)
$timeDiffRef = min($timeDiffRef, TIME_ONE_VISIT);
}
if(!isset($idPageRef)
|| $idPageRef === false )
{
$idPageRef = 0;
}
else
{
printDebug("We know its page ref id=$idPageRef and he stayed on it $timeDiffRef seconds <br>");
}
/**
* Current visitor is a new visitor or an old one
* but without cookie, so we put a cookie
*/
if(isset($newVisitor) || isset($tryPutCookie))
{
// record it and set the cookie
$idCookie = $GLOBALS['cookie']->put(isset($idCookie)?$idCookie:'');
// case : visitor known but cookie not set during his first page views...
if(isset($idVisit))
{
$GLOBALS['cookie']->setVar('idvisit', $idVisit);
}
else
{
$lastVisit = todayTime();
}
}
/**
* Visitor is known, we now look if it's a new visit or not
*/
// is the visit older than 30 minutes ?
if(!isset($newVisitor))
{
if(DEBUG)
printDebug("(idvisit = $idVisit, ".getTimeForDisplay($serverTime)." | now : " .
todayTime()." :: first page last time : $serverTime)");
if ($serverDate == date("Y-m-d")
&& ($lastVisit > (todayTime() - TIME_ONE_VISIT))
)
{
// yes, new visit
$GLOBALS['cookie']->setVar('last_visit_time', todayTime());
$knownVisit = true;
printDebug("<br><b>=>Visit is known on date : $serverDate</b><br>");
}
else
{
printDebug("=>Last visit is too old <b>==> New visit</b><br>");
$returningVisitor = 1;
}
}
else
{
printDebug("<br><b>=>New Visitor also means new visit</b><br>");
}
/**
* Current visit is a known visit
*/
// save current page, etc.
if(isset($knownVisit) && $knownVisit)
{
// we know
// * $lastVisit
// * $idVisit
// * $idCookie
// update last_visit_time
printDebug("==> This is a visit known... we update the data <br>");
// do it first because we need idpage for visit info insert
//print("$pageName <br> $pageUrl <br> $pageCategory ");exit;
$a_idPages = recordDbPage($pageName, $pageUrlParamsProcessed, $pageCategory, false);
$idPage = $a_idPages[0];
// save current page & url & variables information
$idLink_vp = recordDbInfoPage($idVisit, $idPage, $idPageRef, $timeDiffRef, $a_vars);
$total_time = DEFAULT_TIME_PAGE + todayTime() - $serverTime;
// update last_visit_time & total_pages & c_total_time
$r = query("UPDATE ".T_VISIT."
SET last_visit_time = CURRENT_TIME(),
total_pages = total_pages + 1,
total_time = '$total_time',
exit_idpage = '$idPage'
WHERE idvisit = '$idVisit'
LIMIT 1");
}
/*
* Current visit a new visit
*/
// now we know the visitor and its idcookie
// save new visit
else
{
printDebug("==> This is a new visit, we create datas in the database when necessary<br>");
if(!isset($ip) || !isset($ip2long))
{
$ip = getIp();
$ip2long = ip2long($ip);
exitIfIpExcluded($ip2long, $logo, $site);
}
$hostExt = getHostnameExt(getHost($ip));
printDebug('<br>ip : '.$ip);
printDebug('<br>hostname : '.$hostExt);
$serverDate = date("Y-m-d");
$serverTime = date("H:i:s");
$country = getCountry($hostExt, $browserLang);
if($country == 'gb')
{
$country = 'uk';
}
$continent = getContinent($country);
if(strlen($refererUrl)===0)
{
$refererUrl = 'NULL';
}
else
{
$refererUrl = "'".$refererUrl."'";
}
// do it first because we need idpage for visit info insert
$a_idPages = recordDbPage($pageName, $pageUrlParamsProcessed, $pageCategory, true);
$idPageUrl = $a_idPages[1];
$idPage = $a_idPages[0];
$md5Config = md5( $os . serialize($a_browser) . $resolution . $colorDepth . $pdf
. $flash . $java . $javascript . $director . $quicktime . $realPlayer . $windowsMedia . $cookieAccept
. $ip2long . $browserLang);
// save visitor information
$r = query("INSERT INTO ".T_VISIT."
(idsite, idcookie, returning, last_visit_time, server_date, server_time, md5config,
referer, os, browser_name, browser_version, resolution, color_depth,
pdf, flash, java, javascript, director, quicktime, realplayer, windowsmedia, cookie,
local_time, ip, hostname_ext, browser_lang, country, continent,
total_pages, total_time, entry_idpage, entry_idpageurl, exit_idpage)
VALUES ('$idSite', '$idCookie', '$returningVisitor', CURRENT_TIME(),
'$serverDate', '$serverTime', '$md5Config',
$refererUrl, '$os', '".$a_browser['shortName']."',
'".$a_browser['version']."', '$resolution', '$colorDepth',
'$pdf', '$flash','$java', '$javascript', '$director', '$quicktime', '$realPlayer', '$windowsMedia', '$cookieAccept',
'$localTime','$ip2long', '$hostExt', '$browserLang', '$country', '$continent',
1, '".DEFAULT_TIME_PAGE ."', '$idPage', '$idPageUrl', '$idPage')
");
$idVisit = mysql_insert_id();
// save page view and URL and variables
recordDbInfoPage($idVisit, $idPage, $idPageRef, $timeDiffRef, $a_vars);
// save idvisit
$GLOBALS['cookie']->setVar('idvisit', $idVisit);
$GLOBALS['cookie']->setVar('last_visit_time', todayTime());
$GLOBALS['cookie']->setVar('server_time', todayTime());
$GLOBALS['cookie']->setVar('server_date', $serverDate);
}
$GLOBALS['cookie']->setVar('idpage_ref', $idPage);
$GLOBALS['cookie']->save();
printDebug("<br><b>Next cookie should be :</b>");
printDebug($GLOBALS['cookie']->getContent());
// footer
if(PRINT_QUERY_COUNT)
printQueryCount();
if(PRINT_TIME)
printTime();
if(SAVE_DB_LOG)
{
recordDbQueryCount($idSite);
}
require_once INCLUDE_PATH . "/core/include/common.functions.php";
$crontabFile = INCLUDE_PATH . "/config/crontab.php";
if(is_file($crontabFile))
{
include($crontabFile);
}
if( WEB_CRONTAB
&& is_writable( $crontabFile)
&&
(
// if crontab doesn't exist in the file or the file doesn't exist
// or if the last try was before today
( !isset($crontab)
|| $crontab['date_last_success'] != getDateFromTimestamp(time())
)
&&
(
!is_file($crontabFile)
|| ( isset($crontab)
&& $crontab['time_last_try'] < time() - TIME_TO_WAIT_FOR_PARALLEL_ARCHIVE // every 5min
)
)
)
)
{
$crontab['time_last_try'] = time();
$crontab['date_last_success'] = '2000-12-31';
saveConfigFile( $crontabFile, $crontab, "crontab");
printDebug('==========================<br>
CRONTAB BEGIN/ <br>
==========================<br>
');
require_once INCLUDE_PATH . '/core/include/PmvConfig.class.php';
require_once INCLUDE_PATH . '/core/include/ApplicationController.php';
$r =& Request::getInstance();
$r->setModuleName('send_mail');
$r->setCrontabAllowed();
ApplicationController::init();
printDebug('==========================<br>
CRONTAB END/ <br>
==========================<br>
');
$crontab['date_last_success'] = getDateFromTimestamp(time());
saveConfigFile( $crontabFile, $crontab, "crontab");
}
$db->close();
redirectToUrlIfNecessary();
loadImage($logo, $idSite);
// flush content for display
if(DEBUG)
ob_end_flush();
?>
Code4
<?php
/*
* phpMyVisites : website statistics and audience measurements
* Copyright (C) 2002 - 2006
* http://www.phpmyvisites.net/
* phpMyVisites is free software (license GNU/GPL)
* Authors : phpMyVisites team
*/
// $Id: version.php 232 2007-07-06 09:31:19Z matthieu_ $
define('PHPMV_VERSION', '2.3');
?>
Aidez moi s'il vous plait
Cordialement à vous
Si T chez Onlc, ils ont leur propres stats. Il vo les activer dans Configuration. Si ta un problème, contacte lé, ils sont simpa
Correctly accomplishing Ray Ban sun energy sunglasses have started unquestionably some sort of icon presently. This valuable <a href="http://www.rayban3025.uk.com/">ray ban 3025</a> are in reality cloned on versions boasts marketed supplementary than merely with regards to other manufacturers for darkish spectacles.
http://www.rayban3025.uk.com/