<html>
 
 
<head>
 
<title>Biométrie</title>
 
<style type="text/css">
 
body {
 
    background-color:#D0D0D0
 
}
 
h1 {
 
    font-family:times new roman;
 
    font-size:24pt;
 
    font-weight:bold;
 
    font-style:italic;
 
    color:#000080
 
}
 
td {
 
    font-family:arial;
 
    font-size:10pt
 
}
 
.cat {
 
    font-family:arial;
 
    font-size:10pt;
 
    font-weight:bold;
 
    color:#000000;
 
    background-color:#80FFFF
 
}
 
.dat {
 
    font-family:arial;
 
    font-size:10pt;
 
    text-align:right;
 
    color:#000000;
 
    background-color:#FFFF80
 
}
 
.r {
 
    color:#FF0000
 
}
 
.nota {
 
    font-family:arial;
 
    font-size:10pt;
 
    color:#505050;
 
    background-color:#FFFF80;
 
    width:460px;
 
    border: 1px solid red;
 
}
 
</style>
 
</head>
 
 
<body>
 
 
<h1>Biométrie corporelle</h1>
 
 
<?php if(!isset($_POST['submit']) || strlen($_POST['submit'])==0) {
 
 
$CBage = "<select name='age'><option value='30'>";
 
for($n=1; $n<101; $n++) { $CBage .= "<option value='$n'>$n"; }
 
$CBage .= "</select>";
 
?>
 
<script language="javascript" type="text/javascript">
 
function isCharInList(c,list) {
 
    var c,list;
 
    if (list.indexOf(c.toLowerCase()) < 0) { return false; } else { return true; }
 
}
 
function isStringInList(str,list) {
 
    var str,list;
 
    for (n=0; n<str.length; n++) {
 
        if (!isCharInList(str.substring(n,n+1),list)) { return false; }
 
    }
 
    return true;
 
}
 
 
var chars = "0123456789.,";
 
 
function verif() {
 
    noheight  = "Taille manquante";
 
    noweight  = "Poids manquant";
 
    badsize   = "Erreur dans la taille";
 
    badweight = "Erreur dans le poids";
 
    if(document.data.height.value == "") {
 
        alert(noheight);
 
        document.data.height.focus();
 
        return false;
 
    }
 
    if(!isStringInList(document.data.height.value,chars)) {
 
        alert(badheight);
 
        document.data.height.focus();
 
        return false;
 
    }
 
    if(document.data.weight.value == "") {
 
        alert(noweight);
 
        document.data.weight.focus();
 
        return false;
 
    }
 
    if(!isStringInList(document.data.weight.value,chars)) {
 
        alert(badweight);
 
        document.data.weight.focus();
 
        return false;
 
    }
 
    return true;
 
}
 
</script>
 
<form method="post" name="data" action="<?php echo $_SERVER['PHP_SELF']; ?>" onsubmit="return verif()">
 
<table border="1">
 
<tr>
 
    <td>Sexe</td>
 
    <td>
 
        <input type="radio" name="sex" value="1">Homme  
 
        <input type="radio" name="sex" value="2">Femme
 
    </td>
 
</tr>
 
<tr>
 
    <td>Age</td>
 
    <td><?php echo $CBage; ?></td>
 
</tr>
 
<tr>
 
    <td>Activité</td>
 
    <td>
 
        <input type="radio" name="work" value="1">Actif  
 
        <input type="radio" name="work" value="0">Sédentaire
 
    </td>
 
</tr>
 
<tr>
 
    <td class="r">Taille (en m) *</td>
 
    <td><input type="text" name="height" size="5"></td>
 
</tr>
 
<tr>
 
    <td class="r">Poids (en kg) *</td>
 
    <td><input type="text" name="weight" size="5"></td>
 
</tr>
 
</table>
 
<input type="submit" name="submit" value="Calculer">
 
</form>
 
 
<div class="nota">
 
<b> NOTA</b>:<br/>
 
 Séparateur décimal pour la taille et le poids peuvent être le point ou la virgule<br/>
 
 En rouge avec astérique : donnée obligatoire<br/>
 
 Si le Sexe n'est pas mentionné, vous êtes supposé être un homme<br/>
 
 Si l'age n'est pas mentionné, vous êtes supposé avoir 30 ans<br/>
 
 Si l'activité n'est pas mentionnée, vous êtes supposé être actif.<br/>
 
</div>
 
 
<?php } else {
 
include_once("texts.fr.php");
 
require("class.biometrics.php4.php");
 
 
// 26/01/2008. Yiannis VAVOURANAKIS:
 
// Since my french isn't that good, I leave it up to you to translate this to french properly...
 
// Normalement, on doit choisir l'info et créer un tableau comme ca:
 
// $data = array(    'weight' => isset($_POST['weight']) ? $_POST['weight'] : "",
 
//            'height' => isset($_POST['height']) ? $_POST['height'] : "",
 
//            'age'    => isset($_POST['age'])    ? $_POST['age']    : "",
 
//            'sex'    => isset($_POST['height']) ? $_POST['sex']    : "",
 
//            'work'   => isset($_POST['work'])   ? $_POST['work']   : "",
 
//            'nbdec'  => 4);
 
//
 
// Mais, cette forme a seulement l'info nécessaire, alors on utilise le tableau $_POST.
 
// SVP, notez que normalement, on doit vérifier TOUTE information par le forme, et ne pas
 
// l'utiliser immédiatemment, comme ici.
 
 
$body = new biometrics($_POST);
 
?>
 
 
<table border="1">
 
<tr>
 
    <td colspan="2" class="cat">Données</td>
 
</tr>
 
<tr>
 
    <td>Sexe</td>
 
    <td class="dat"><?php echo $body->getSex(); ?></td>
 
</tr>
 
<tr>
 
    <td>Age</td>
 
    <td class="dat"><?php echo $body->getAge()." yo"; ?></td>
 
</tr>
 
<tr>
 
    <td>Activité</td>
 
    <td class="dat"><?php echo $body->getWork(); ?></td>
 
</tr>
 
<tr>
 
    <td>Taille</td>
 
    <td class="dat"><?php echo $body->getHeight()." cm"; ?></td>
 
</tr>
 
<tr>
 
    <td>Poids</td>
 
    <td class="dat"><?php echo $body->getWeight()." kg"; ?></td>
 
</tr>
 
<tr>
 
    <td colspan="2" class="cat">IMC: Indice de Masse Corporelle</td>
 
</tr>
 
<tr>
 
    <td>Indice de Masse Corporelle</td>
 
    <td class="dat"><?php echo $body->bmi(); ?></td>
 
</tr>
 
<tr>
 
    <td>Niveau IMC</td>
 
    <td class="dat"><?php echo $body->evalbmi(); ?></td>
 
</tr>
 
<tr>
 
    <td>Diagnostic IMC</td>
 
    <td class="dat"><?php echo $body->bmistatus(); ?></td>
 
</tr>
 
<tr>
 
    <td>Plage de poids correct</td>
 
    <td class="dat"><?php echo "entre ".$body->llimit()." et ".$body->hlimit()." kg"; ?></td>
 
</tr>
 
<tr>
 
    <td colspan="2" class="cat">PI: Poids Idéal</td>
 
</tr>
 
<tr>
 
    <td>Formule de Devine (1974)</td>
 
    <td class="dat"><?php echo $body->devine()." kg"; ?></td>
 
</tr>
 
<tr>
 
    <td>Formule de Lorentz (1929)</td>
 
    <td class="dat"><?php echo $body->lorentz()." kg"; ?></td>
 
</tr>
 
<tr>
 
    <td>Formule de Lorentz (selon l'âge)</td>
 
    <td class="dat"><?php echo $body->lorentza()." kg"; ?></td>
 
</tr>
 
<tr>
 
    <td>Formule de Peck's</td>
 
    <td class="dat"><?php echo $body->pecks()." kg"; ?></td>
 
</tr>
 
<tr>
 
    <td colspan="2" class="cat">PM: Poids Maigre</td>
 
</tr>
 
<tr>
 
    <td>Formule de Hume (1966)</td>
 
    <td class="dat"><?php echo $body->hume_lbm()." kg"; ?></td>
 
</tr>
 
<tr>
 
    <td>Formule de James (1981)</td>
 
    <td class="dat"><?php echo $body->james()." kg"; ?></td>
 
</tr>
 
<tr>
 
    <td colspan="2" class="cat">CET: Calcul de l'Eau Totale</td>
 
</tr>
 
<tr>
 
    <td>Formule de Hume</td>
 
    <td class="dat"><?php echo $body->hume_ctw()." kg"; ?></td>
 
</tr>
 
<tr>
 
    <td>Formule de Watson</td>
 
    <td class="dat"><?php echo $body->watson()." kg"; ?></td>
 
</tr>
 
<tr>
 
    <td colspan="2" class="cat">CSC: Calcul de la Surface Corporelle</td>
 
</tr>
 
<tr>
 
    <td>Formule de Boyd (la plus precise)</td>
 
    <td class="dat"><?php echo $body->boyd()." m²"; ?></td>
 
</tr>
 
<tr>
 
    <td>Formule de Dubois et Dubois (1916)</td>
 
    <td class="dat"><?php echo $body->dubois()." m²"; ?></td>
 
</tr>
 
<tr>
 
    <td>Formule de Dubois et Dubois, autre formule</td>
 
    <td class="dat"><?php echo $body->dubois2()." m²"; ?></td>
 
</tr>
 
<tr>
 
    <td>Formule de Gehan et George (1970)</td>
 
    <td class="dat"><?php echo $body->gehan()." m²"; ?></td>
 
</tr>
 
<tr>
 
    <td>Formule de Haycock (1978)</td>
 
    <td class="dat"><?php echo $body->haycock()." m²"; ?></td>
 
</tr>
 
<tr>
 
    <td>Formule de Mosteller (1987)</td>
 
    <td class="dat"><?php echo $body->mosteller()." m²"; ?></td>
 
</tr>
 
<tr>
 
    <td colspan="2" class="cat">DER: Dépense Energétique au Repos</td>
 
</tr>
 
<tr>
 
    <td>Formule de Black et al (1996)</td>
 
    <td class="dat"><?php echo $body->black()." Kcal"; ?></td>
 
</tr>
 
<tr>
 
    <td>Formule de Harris et Benedict (1919)</td>
 
    <td class="dat"><?php echo $body->harris()." Kcal"; ?></td>
 
</tr>
 
<tr>
 
    <td>Formule de Harris et Benedict recalculé par Roza et Shizgal (1994)</td>
 
    <td class="dat"><?php echo $body->harrisrs()." Kcal"; ?></td>
 
</tr>
 
<tr>
 
    <td colspan="2" class="cat">BEJ: Besoin Energétique Journalier</td>
 
</tr>
 
<tr>
 
    <td>Besoin Energétique Journalier d'après la formule de Black et al</td>
 
    <td class="dat"><?php echo $body->enerneed(). " Kcal"; ?></td>
 
</tr>
 
</table>
 
 
<p><center><form><input type="button" value="Fermer" onclick="javascript:window.close()"></form></center><p>
 
<?php } ?>
 
 
</body>
 
</html>
 
 |