<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>Statistic</title>
</head>
<body>
<?php
// time counter
$start = microtime(True);
include("connection.php");
$result1= $bdd->query('SELECT count(*) FROM personnes');
$donnee1=$result1->fetch();
$result2= $bdd->query('SELECT count(*) FROM personnes WHERE Sexe=\'male\'');
$donnee2=$result2->fetch();
$result3 = $bdd->query('SELECT count(*) FROM STAT');
$donnee3=$result3->fetch();
$totalCount = $donnee1[0];
$manCount = $donnee2[0];
$visitCount =$donnee3[0];
echo '<table border="1">';
echo '<tr>';
echo '<td>Number of users</td>';
echo '<td>'.$totalCount,'</td>';
echo '</tr><tr><td>Number of males</td>';
echo '<td>'.$manCount.'</td>';
echo '</tr><tr><td>Pourcentage of males</td>';
echo '<td>'.(int)($manCount/$totalCount*100),'%</td>';
echo '</tr><tr><td>Number of females</td>';
echo '<td>'.($totalCount - $manCount).'</td>';
echo '</tr><tr><td>Pourcentage of females</td>';
echo '<td>'.(100 - (int)($manCount/$totalCount*100)).'%</td>';
echo '</tr><tr>';
echo '<td>Number of visits</td>';
echo '<td>'.$visitCount.'</td>';
echo '</tr><tr><td>Processed time</td>';
echo '<td>'.(microtime(True)-$start).'s</td>';
echo '</table>';
?>
<?php
$persco = $bdd->query('SELECT * FROM stat');
echo '<table>';
echo '<td>Plage Horaire</td>';
echo '<td>Visites </td>';
while($result=$persco->fetch()) {
;
$plagefin = $result["plage"] + 1;
if($plagefin == 24)
$plagefin = 0;
echo '<tr>';
echo '<td>' . $result["plage"] .':00 à '. $plagefin . ':00</td>';
echo '<td>' . $result["nb"] .'</td>';
echo '</tr>';
}
?>
<form action="stan.php" method="post" enctype="multipart/form-data"> </form><!-- PUIS ON DEMANDE S IL L ADMINISTRATEUR VEUT UN CERTAIN NOMBRE DE PLAGE LES PLUS POPULAIRE A L AIDE D UN FORMULAIRE-->
N meilleur plage: <select name="n"> <!-- TYPE DE LISTE DEROULANTE-->
<option value="1">1</option>
<option value="2">2</option>
<option value="3">3</option>
<option value="4">4</option>
<option value="5">5</option>
<option value="6">6</option>
<option value="7">7</option>
<option value="8">8</option>
<option value="9">9</option>
<option value="10">10</option>
<option value="11">11</option>
<option value="12">12</option>
<option value="13">13</option>
<option value="14">14</option>
<option value="15">15</option>
<option value="16">16</option>
<option value="17">17</option>
<option value="18">18</option>
<option value="19">19</option>
<option value="20">20</option>
<option value="21">21</option>
<option value="22">22</option>
<option value="23">23</option>
<option value="24">24</option>
</select>
<input type="submit" value="Demander">
</form>
</body>
</html>