1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76
| <?php
//recupere date du jour
$date = date('Y-m-d', time() - 3600 * 24);
//date ("Ymd");
//Connection Mysql
mysql_connect("*","*","*")or die("Problème avec la base de données");
mysql_select_db("*")or die ("pas de connection");
$reponse = mysql_query("SELECT COUNT(*)
FROM `jom15_jstats_visits`
WHERE `visit_date` = '$date'"); // Requête SQL
// On fait une boucle pour lister tout ce que contient la table :
//***********************************************************************************************************************
if ($date)
{
//*************************************************************************************************************************
while ($donnees = mysql_fetch_array($reponse))
{
//Envoi mail
$to = 'bidule@aol.coop' ;
$subject = 'Nombre de visiteurs' ;
$body = '<HTML>' ;
$body = $body . '<HEAD>' ;
$body = $body . '</HEAD>' ;
$body = $body . '<BODY>' ;
$body = $body . '<p>';
$body = $body . 'Nombre de visiteurs du ';
$body = $body . $date;
$body = $body . '</p>';
$body = $body . '<div width="300">' ;
$body = $body . '<center>';
$body = $body . '<table border="1" cellspacing="3" cellpadding="3">' ;
$body = $body . '<tr>' ;
$body = $body . '<td>' ;
$body = $body . $date;
$body = $body . '</td>' ;
$body = $body . '<td>' ;
$body = $body . $donnees [0];
$body = $body . '</td>' ;
$body = $body . '<tr>' ;
$body = $body . '</table>' ;
$body = $body . '</center>';
$body = $body . '</div>' ;
$body = $body . '</BODY>' ;
$body = $body . '</HTML>' ;
$headers = "MIME-Version: 1.0\r\n" . "Content-type: text/html; charset=iso-8859-1\r\n" . "From: siteInterval.coop" ;
mail($to, $subject, $body , $headers);
}
//mysql_close(); // Déconnexion de MySQL
//****************************************************************************************************
}
else
{
'';
}
//****************************************************************************************************
?> |
Partager