Dépôt officiel du core SPIP * Copie possible par svn sur svn://trac.rezo.net/spip * Les svn:externals sont présent dans https://git.spip.net/SPIP/[nom du plugin dist]
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 

39 lines
925 B

<?php
//
// Ce fichier ne sera execute qu'une fois
if (defined("_INC_STATS")) return;
define("_INC_STATS", "1");
function ecrire_stats() {
global $HTTP_REFERER;
global $id_article;
global $admin_ok;
$my_ref = $HTTP_REFERER;
$my_ref = "\n".substr(md5($my_ref), 0, 15);
$query = "SELECT visites, referers FROM spip_articles WHERE id_article=$id_article AND statut='publie'";
$result = mysql_query($query);
if ($row = mysql_fetch_array($result)) {
$visites = $row[0];
$referers = $row[1];
$visites++;
if (!ereg($my_ref, $referers)) {
$referers .= $my_ref;
mysql_query("UPDATE spip_articles SET visites=$visites, referers='$referers' WHERE id_article=$id_article");
}
else {
mysql_query("UPDATE spip_articles SET visites=$visites WHERE id_article=$id_article");
}
$num_ref = strlen($referers) / 16;
if ($admin_ok) echo "<small>[$visites visites - $num_ref referers]</small>";
}
}
?>