summaryrefslogtreecommitdiff
path: root/kalorien_rechner/ausgabe.php
diff options
context:
space:
mode:
Diffstat (limited to 'kalorien_rechner/ausgabe.php')
-rwxr-xr-xkalorien_rechner/ausgabe.php118
1 files changed, 118 insertions, 0 deletions
diff --git a/kalorien_rechner/ausgabe.php b/kalorien_rechner/ausgabe.php
new file mode 100755
index 0000000..5aa63ab
--- /dev/null
+++ b/kalorien_rechner/ausgabe.php
@@ -0,0 +1,118 @@
+<?php
+session_start();
+
+if (isset($_POST['rechnen'])) {
+ $geschlecht = $_POST['geschlecht'];
+ $gewicht = $_POST['gewicht'];
+ $groesse = $_POST['groesse'];
+ $alter = $_POST['alter'];
+ $aktivitaet = $_POST['aktivitaet'];
+ $sport = $_POST['sport'];
+ $ziel = $_POST['ziel'];
+
+ if ($geschlecht == 'maennlich') {
+ $grundumsatz = 66.47 + (13.7 * $gewicht) + (5 * $groesse) - (6.8 * $alter);
+ } else $grundumsatz = 655.1 + (9.6 * $gewicht) + (1.8 * $groesse) - (4.7 * $alter);
+
+ $leistungsumsatz = ($grundumsatz * $aktivitaet) + ($sport * 100);
+
+ if ($ziel == 'abnehmen') {
+ $absolut_kalorien = $leistungsumsatz - 400;
+ } elseif ($ziel == 'zunehmen') {
+ $absolut_kalorien = $leistungsumsatz + 400;
+ } else $absolut_kalorien = $leistungsumsatz;
+
+ if ($ziel == 'abnehmen') {
+ $protein = $gewicht * 2.2;
+ } else if ($ziel == 'zunehmen') {
+ $protein = $gewicht * 1.8;
+ } else $protein = $gewicht * 2;
+
+ $protein = $protein > 0 ? round($protein) : 0;
+ $absolut_zucker = $absolut_kalorien / 40;
+ $zucker = $absolut_zucker > 0 ? round($absolut_zucker) : 0;
+ $absolut_kohlenhydrate = ($absolut_kalorien - (4 * $protein) - (9 * $gewicht) - (4 * $zucker)) / 4;
+ $kohlenhydrate = $absolut_kohlenhydrate > 0 ? round($absolut_kohlenhydrate) : 0;
+ $fett = $gewicht;
+ $kalorien = $absolut_kalorien > 0 ? round($absolut_kalorien) : 0;
+}
+?>
+
+<!DOCTYPE html>
+<html lang="de">
+<head>
+ <meta charset="UTF-8">
+ <meta name="viewport" content="width=device-width, initial-scale=1.0">
+ <title>Kalorien Ausgabe</title>
+ <link rel="icon" type="image/x-icon" href="/style/avocado.png">
+ <link rel="stylesheet" type="text/css" href="/style/style.css">
+</head>
+<body>
+<nav class="medium_box">
+ <ul class="hor_spacing">
+ <li class="hor_spacing_item">
+ <a class="small_box color_inverse_on_hover" href="/login">Login</a>
+ </li>
+ <li class="hor_spacing_item">
+ <a class="small_box tertiary_color_style" href="/kalorien_rechner">Kalorien-rechner</a>
+ </li>
+ <li class=hor_spacing_item>
+ <a class="small_box color_inverse_on_hover" href="/kalorien_zaehler">Kalorien-zähler</a>
+ </li>
+ <li class="hor_spacing_item">
+ <a class="small_box color_inverse_on_hover" href="/rezepte">Rezepte</a>
+ </li>
+ <li class="hor_spacing_item">
+ <a class="small_box color_inverse_on_hover" href="/workouts">Workouts</a>
+ </li>
+ </ul>
+</nav>
+<main class="big_box hor_spacing">
+ <h1>Täglicher Bedarf</h1>
+
+ <?php if (isset($_POST['rechnen'])) { ?>
+ <div class="flexbox hor_spacing_item">
+ <div class="medium_box" style="flex: 1">
+ <h2 style="margin: 0">Proteine:</h2>
+ <div style="font-size: 100px"><?= $protein ?></div>
+ <h2 style="margin: 0">gramm</h2>
+ </div>
+ <div class="medium_box" style="flex: 1">
+ <h2 style="margin: 0">Kohlenhydrate:</h2>
+ <div style="font-size: 100px"><?= $kohlenhydrate ?></div>
+ <h2 style="margin: 0">gramm</h2>
+ </div>
+ <div class="medium_box" style="flex: 1">
+ <h2 style="margin: 0">Fette:</h2>
+ <div style="font-size: 100px"><?= $fett ?></div>
+ <h2 style="margin: 0">gramm</h2>
+ </div>
+ </div>
+ <div class="flexbox hor_spacing_item">
+ <div class="medium_box" style="flex: 1">
+ <h2 style="margin: 0">Zucker:</h2>
+ <div style="font-size: 100px"><?= $zucker ?></div>
+ <h2 style="margin: 0">gramm</h2>
+ </div>
+ <div class="medium_box" style="flex: 2">
+ <h2 style="margin: 0">Um ihr Ziel zu erreichen müssen Sie am Tag</h2>
+ <div style="font-size: 100px"><?= $kalorien ?></div>
+ <h2 style="margin: 0">Kalorien zu sich nehmen</h2>
+ </div>
+ <form action="/kalorien_zaehler/index.php" method="POST" style="flex: 1">
+ <input style="display: none" name="gesamt_kalorien" value="<?= $zielkalorien ?>" />
+ <input style="display: none" name="gesamt_kohlenhydrate" value="<?= $kohlenhydrate ?>" />
+ <input style="display: none" name="gesamt_fett" value="<?= $fett ?>" />
+ <input style="display: none" name="gesamt_protein" value="<?= $protein ?>" />
+ <input style="display: none" name="gesamt_zucker" value="<?= $zucker ?>" />
+ <button class="medium_box color_inverse_on_hover" style="height: 100%; width: 100%" type="submit" name="werte_uebernehmen">
+ <h2 style="font-size: 50px; margin: 0">Werte<br>Speichern</h2>
+ </button>
+ </form>
+ </div>
+ <?php } else { ?>
+ <h2>Fülle erst das <a class="small_box color_inverse_on_hover" href="/kalorien_rechner">Formular</a> aus!</h2>
+ <?php } ?>
+</main>
+</body>
+</html>