66 lines
3.1 KiB
PHP
66 lines
3.1 KiB
PHP
<?php
|
|
session_start();
|
|
include("../scripts/connection.php");
|
|
include("../scripts/functions.php");
|
|
$user_data=check_login($con);
|
|
|
|
if($_SERVER['REQUEST_METHOD'] == "GET") {
|
|
$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) {
|
|
if ($millis < 10) {
|
|
$time = "00:" . $minutes . ":" . $seconds . "." . "0" . $millis;
|
|
} else {
|
|
$time = "00:" . $minutes . ":" . $seconds . "." . $millis;
|
|
}
|
|
change_time($con, $m_id, $s_id, $time);
|
|
}
|
|
|
|
header("Location: statistik.php");
|
|
die;
|
|
}
|
|
?>
|
|
<body>
|
|
<div class="headline">
|
|
<h2>Ergebniss bearbeiten</h2>
|
|
</div>
|
|
<div>
|
|
<form method="post">
|
|
<label for="team_name">Mannschaftsname: </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'] / 1e4 . "\""; }?>/><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>
|
|
<?php
|
|
$con = null;
|
|
echo file_get_contents("header_footer/footer.html");
|
|
?>
|