92 lines
2.5 KiB
PHP
92 lines
2.5 KiB
PHP
<?php
|
|
|
|
// ========== Form handling logic ==========
|
|
$form_message = $_SESSION['form_message'] ?? '';
|
|
unset($_SESSION['form_message']);
|
|
|
|
if ((isset($_POST['prev_abt'])) && !empty($_POST['prev_abt_submit'])) {
|
|
verify_csrf();
|
|
$value = $aktabt;
|
|
if ($value > 1){
|
|
$value -= 1;
|
|
$name = 'wk_panel_current_abt';
|
|
|
|
$stmt = $mysqli->prepare("INSERT INTO $tableVar (`name`, `value`) VALUES (?, ?) ON DUPLICATE KEY UPDATE `value` = VALUE(`value`)");
|
|
|
|
$stmt->bind_param("ss", $name, $value);
|
|
|
|
$stmt->execute();
|
|
$stmt->close();
|
|
}
|
|
header("Location: /intern/kampfrichter");
|
|
exit;
|
|
}
|
|
|
|
if ((isset($_POST['next_abt'])) && !empty($_POST['next_abt_submit'])) {
|
|
verify_csrf();
|
|
$value = $aktabt;
|
|
$maxvalue = db_get_var($mysqli, "SELECT name FROM $tableAbt ORDER BY name DESC LIMIT 1");
|
|
|
|
if ($value < $maxvalue){
|
|
$value += 1;
|
|
$name = 'wk_panel_current_abt';
|
|
|
|
$stmt = $mysqli->prepare("INSERT INTO $tableVar (`name`, `value`) VALUES (?, ?) ON DUPLICATE KEY UPDATE `value` = VALUE(`value`)");
|
|
|
|
$stmt->bind_param("ss", $name, $value);
|
|
|
|
$stmt->execute();
|
|
$stmt->close();
|
|
}
|
|
header("Location: /intern/kampfrichter");
|
|
exit;
|
|
}
|
|
|
|
|
|
if (!isset($_SESSION['currentsubabt'])){
|
|
$_SESSION['currentsubabt'] = 1;
|
|
}
|
|
|
|
if (!isset($_SESSION['last_abt'])){
|
|
$_SESSION['last_abt'] = $aktabt;
|
|
}
|
|
|
|
if ($_SESSION['last_abt'] !== $aktabt){
|
|
$_SESSION['currentsubabt'] = 1;
|
|
$_SESSION['last_abt'] = $aktabt;
|
|
}
|
|
|
|
if ((isset($_POST['prev_subabt'])) && !empty($_POST['prev_subabt_submit'])) {
|
|
verify_csrf();
|
|
$value = $_SESSION['currentsubabt'];
|
|
if ($value > 1){
|
|
$_SESSION['currentsubabt']--;
|
|
$_SESSION['currentEditId'] = false;
|
|
$_SESSION['last_abt'] = $aktabt;
|
|
}
|
|
header("Location: /intern/kampfrichter");
|
|
exit;
|
|
}
|
|
|
|
if ((isset($_POST['next_subabt'])) && !empty($_POST['next_subabt_submit'])) {
|
|
verify_csrf();
|
|
$value = $_SESSION['currentsubabt'];
|
|
if ($value < $maxsubabt){
|
|
$_SESSION['currentsubabt']++;
|
|
$_SESSION['currentEditId'] = false;
|
|
$_SESSION['last_abt'] = $aktabt;
|
|
}
|
|
header("Location: /intern/kampfrichter");
|
|
exit;
|
|
}
|
|
|
|
if ( isset($_POST['togle_advanced_mode_admin']) && !empty($_POST['togle_advanced_mode_admin_submit']) && !empty($_POST['csrf_token'])) {
|
|
verify_csrf();
|
|
$current_value = $focus_view_admin;
|
|
$new_value = !$current_value;
|
|
|
|
$_SESSION['abtViewAdmin'] = $new_value;
|
|
|
|
header("Location: /intern/kampfrichter");
|
|
exit;
|
|
} |