added edit statistics

This commit is contained in:
2022-06-12 22:12:30 +02:00
parent afbfe52688
commit 4118f76f92
5 changed files with 135 additions and 2 deletions

View File

@@ -8,6 +8,26 @@
$row = get_result($con, $_GET["m_id"], $_GET['s_id'])->fetch();
include("header_footer/header.php");
}
if($_SERVER['REQUEST_METHOD'] == 'POST') {
$m_id = intval($_POST['m_id']);
$s_id = intval($_POST['s_id']);
$points = intval($_POST['points']);
$minutes = intval($_POST['minutes']);
$seconds = intval($_POST['seconds']);
$millis = intval($_POST['millis']);
if (get_points($con, $m_id, $s_id)->fetch()['punkte'] != $points) {
change_points($con, $m_id, $s_id, $points);
}
if (get_minutes($con, $m_id, $s_id)->fetch()['minutes'] != $minutes || get_seconds($con, $m_id, $s_id)->fetch()['seconds'] != $seconds || get_millis($con, $m_id, $s_id)->fetch()['millis'] != $millis) {
$time = "00:" . $minutes . ":" . $seconds . "." . $millis;
change_time($con, $m_id, $s_id, $time);
}
header("Location: statistik.php");
die;
}
?>
<body>
<div class="headline">
@@ -16,7 +36,23 @@
<div>
<form method="post">
<label for="team_name">Mannschaftsname: </label>
<label for=""><?php echo $row['name']?></label>
<label for="" name="team_name"><?php echo $row['name']?></label><br>
<label for="fire_department">Feuerwehr:</label>
<label for="" name="fire_department"><?php echo $row["feuerwehr"]?></label><br>
<label for="points">Punkte:</label>
<input type="number" min="0" max="15" name="points" value="<?php echo $row['punkte']?>"/><br>
<div id="time">
<?php $time_set = check_time($con, $row['m_id'], $row['s_id']);?>
<label for="minutes">Minuten:</label>
<input name="minutes" type="number" min="0" max="60" value=<?php if(!$time_set){echo "\"0\"";} else {echo "\"" . get_minutes($con, $row['m_id'], $row['s_id'])->fetch()['minutes'] . "\""; }?>/><br>
<label for="seconds">Sekunden</label>
<input name="seconds" type="number" min="0" max="60" value=<?php if(!$time_set){echo"\"0\"";} else { echo "\"" . get_seconds($con, $row['m_id'], $row['s_id'])->fetch()['seconds'] . "\""; }?>/><br>
<label for="millis">Millisekunden</label>
<input name="millis" type="number" min="0" max="99" value=<?php if(!$time_set){echo"\"0\"";} else { echo "\"" . get_millis($con, $row['m_id'], $row['s_id'])->fetch()['millis'] . "\""; }?>/><br>
</div>
<input type="hidden" name="m_id" value=<?php echo $row['m_id'] ?>/>
<input type="hidden" name="s_id" value=<?php echo $row['s_id'] ?>/>
<input name="button" type="submit" value="Speichern"/>
</form>
</div>
</body>