Compare commits
8 Commits
c4d62ac658
...
dev
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
484cf11c07 | ||
|
|
2e77ac243b | ||
| 42d3f01176 | |||
|
|
c1ffddfdb2 | ||
| dc4d28cd91 | |||
|
|
bb118e169e | ||
| 458e0cbad9 | |||
| ca6549280f |
@@ -49,7 +49,7 @@
|
|||||||
<body>
|
<body>
|
||||||
<div class="center">
|
<div class="center">
|
||||||
<div class="headline">
|
<div class="headline">
|
||||||
<h2>Ergebniss eintragen</h2>
|
<h2>Ergebnis eintragen</h2>
|
||||||
</div>
|
</div>
|
||||||
<div class="form_div">
|
<div class="form_div">
|
||||||
<form action="" method="post">
|
<form action="" method="post">
|
||||||
|
|||||||
@@ -6,8 +6,11 @@
|
|||||||
|
|
||||||
if($_SERVER['REQUEST_METHOD'] == "POST") {
|
if($_SERVER['REQUEST_METHOD'] == "POST") {
|
||||||
try {
|
try {
|
||||||
$stmt = $con->prepare("DELETE FROM users WHERE id = :id");
|
$selected_user_id = get_id_user_by_user_id($con, $_SESSION['user_id']);
|
||||||
$stmt->execute(['id' => $_POST['id']]);
|
if($selected_user_id != $_POST['id']) {
|
||||||
|
$stmt = $con->prepare("DELETE FROM users WHERE id = :id");
|
||||||
|
$stmt->execute(['id' => $_POST['id']]);
|
||||||
|
}
|
||||||
} catch(PDOException $e) {
|
} catch(PDOException $e) {
|
||||||
handle_pdo_exception($e);
|
handle_pdo_exception($e);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -9,7 +9,8 @@
|
|||||||
$table = $_GET['table'];
|
$table = $_GET['table'];
|
||||||
}
|
}
|
||||||
|
|
||||||
header('Content-type: text/csv');
|
ob_start('ob_gzhandler'); #compressing data which is sent to the browser, the browser will decompress the data automatically
|
||||||
|
header('Content-type: text/csv; charset="UTF-8" ');
|
||||||
header('Content-Disposition: attachment; filename="table.csv" ');
|
header('Content-Disposition: attachment; filename="table.csv" ');
|
||||||
|
|
||||||
function download_table($stmt) {
|
function download_table($stmt) {
|
||||||
|
|||||||
@@ -49,7 +49,7 @@
|
|||||||
<body>
|
<body>
|
||||||
<div class="center">
|
<div class="center">
|
||||||
<div class="headline">
|
<div class="headline">
|
||||||
<h2>Ergebniss bearbeiten</h2>
|
<h2>Ergebnis bearbeiten</h2>
|
||||||
</div>
|
</div>
|
||||||
<div class="form_div">
|
<div class="form_div">
|
||||||
<form method="post">
|
<form method="post">
|
||||||
|
|||||||
@@ -530,3 +530,15 @@ function get_result_team_station($con, $s_id, $m_id) {
|
|||||||
handle_pdo_exception($e);
|
handle_pdo_exception($e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function get_id_user_by_user_id($con, $user_id) {
|
||||||
|
try {
|
||||||
|
$stmt = $con->prepare("SELECT * FROM users WHERE user_id = ?");
|
||||||
|
$stmt->bindParam(1, $user_id, PDO::PARAM_STR);
|
||||||
|
$stmt->execute();
|
||||||
|
$stmt->setFetchMode(PDO::FETCH_ASSOC);
|
||||||
|
return $stmt->fetch()['id'];
|
||||||
|
} catch( PDOException $e) {
|
||||||
|
handle_pdo_exception($e);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -235,6 +235,9 @@ function update_points($con, $s_id) {
|
|||||||
$factor = $results[0]['erg']/ 15.0;
|
$factor = $results[0]['erg']/ 15.0;
|
||||||
foreach($results as $row) {
|
foreach($results as $row) {
|
||||||
$points = round($row['erg']/$factor);
|
$points = round($row['erg']/$factor);
|
||||||
|
if ($points == 0 && $row['erg'] != 0) {
|
||||||
|
$points = 1;
|
||||||
|
}
|
||||||
change_points($con, $row['m_id'], $s_id, $points);
|
change_points($con, $row['m_id'], $s_id, $points);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user