Compare commits

..

7 Commits

5 changed files with 21 additions and 5 deletions

View File

@@ -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">

View File

@@ -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);
} }

View File

@@ -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) {

View File

@@ -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">

View File

@@ -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);
}
}