Files
PunkteSystem-KSP/app/public/add_entry.php

55 lines
2.0 KiB
PHP

<?php
session_start();
include("../scripts/connection.php");
include("../scripts/functions.php");
$user_data = check_login($con);
if($_SERVER['REQUEST_METHOD'] == "POST") {
$points = $_POST['points'];
$minutes = $_POST['minutes'];
$seconds = $_POST['seconds'];
$miliseconds = $_POST['miliseconds'];
if($minutes == 0 && $seconds == 0 && $miliseconds == 0){
$time = null;
} else {
$time = $minutes . ":" . $seconds . "." . $miliseconds;
}
write_points($con, $_GET['station'], $_POST['team'], $points, $time);
header("Location: statistik.php");
die;
}
echo file_get_contents("heder_footer/header.php");
?>
<body>
<div <?php if(!station_exists($con, $_GET['station'])) { echo "hidden=\"true\"";}?>>
<form action="" method="post">
<div id="team-div">
<label for="team">Mannschaft</label>
<select name="team" id="team">
<?php load_teams_no_points($con, $_GET['station'])?>
</select>
</div>
<label for="points">Punkte: </label>
<input name="points" id="points" type="number" max="15" min="0" value="0"/><br>
<label for="zeit">Zeit: </label>
<div id="zeit">
<label for="minutes">Minuten</label>
<input name="minutes" id="minutes" type="number" max="60" min="0" value="0"/><br>
<label for="seconds">Sekunden</label>
<input name="seconds" id="seconds" type="number" max="60" min="0" value="0"/><br>
<label for="miliseconds">Millisekunden</label>
<input name="miliseconds" id="miliseconds" type="number" max="99" min="0" value="0"/>
</div>
<div>
<input id="button" type="submit" value="Eintragen"/>
</div>
</form>
</div>
</body>
<?php
$con = null;
echo file_get_contents("header_footer/footer.html");
?>