75 lines
1.8 KiB
PHP
75 lines
1.8 KiB
PHP
<?php
|
|
require_once '../session_init.php';
|
|
require_once 'config.inc.php';
|
|
require_once 'db.class.php';
|
|
require_once 'log.php';
|
|
$db = new db();
|
|
$db->open();
|
|
|
|
function totaltotal() //nombre d'avions poèmes créés depuis le début
|
|
{
|
|
global $db;
|
|
$query = "SHOW TABLE STATUS LIKE 'avionpoeme'";
|
|
$db->query($query);
|
|
$result = $db->result->fetch_assoc();
|
|
return $result['Auto_increment']-1;
|
|
}
|
|
function total()
|
|
{
|
|
global $db;
|
|
$query = "SELECT COUNT(*) as nAvion FROM avionpoeme";
|
|
$db->query($query);
|
|
$result = $db->result->fetch_assoc();
|
|
return $result["nAvion"];
|
|
|
|
}
|
|
|
|
function totalenvol()
|
|
{
|
|
global $db;
|
|
$query = "SELECT COUNT(*) as n FROM avionpoeme WHERE public!=2";
|
|
$db->query($query);
|
|
$result = $db->result->fetch_assoc();
|
|
return $result["n"];
|
|
}
|
|
|
|
function alea()
|
|
{
|
|
global $db;
|
|
$query = "SELECT COUNT(*) as nAvion FROM avionpoeme WHERE ";
|
|
$db->query($query);
|
|
$result = $db->result->fetch_assoc();
|
|
return $result["n"];
|
|
|
|
}
|
|
|
|
function anonymous()
|
|
{
|
|
global $db;
|
|
$query = "SELECT COUNT(*) as n FROM avionpoeme WHERE expemail=''";
|
|
$db->query($query);
|
|
$result = $db->result->fetch_assoc();
|
|
return $result["n"];
|
|
}
|
|
|
|
|
|
$nAvionCree = totaltotal();
|
|
if ($nAvionCree == 0)
|
|
{
|
|
echo "Aucun avion-poème envoyé pour l'instant";
|
|
}else
|
|
{
|
|
|
|
echo "Nombre total d'avions-poème : " . $nAvionCree . EOL;
|
|
$total = total();
|
|
$avionSupp = $nAvionCree-$total;
|
|
echo "Nombre d'avion supprimés : " . $avionSupp . " => " . $avionSupp/$nAvionCree*100 . "%" . EOL;
|
|
$nAvionenvol = totalenvol();
|
|
echo "Nombre d'avions-poème en vol : " . $nAvionenvol . " => " . $nAvionenvol/$nAvionCree*100 . "%" . EOL;
|
|
$anonymous = anonymous();
|
|
echo "Nombre d'envois anonymes : " . $anonymous . " => " . $anonymous/$nAvionCree*100 . "%" . EOL;
|
|
}
|
|
|
|
|
|
$db->close();
|