melder/admin/district_chk.php

29 lines
831 B
PHP
Raw Normal View History

2024-02-22 14:30:28 +01:00
<?php
session_start();
$strLoginName=(isset($_SESSION['user'])) ? $_SESSION['user'] : "" ;
$boolLogin = (!empty($strLoginName));
if (!$boolLogin) {
header("Location: login.php");
}
require("../config.php");
if($_POST['csrf'] !== $_SESSION['csrf_token']) {
die("Ungültiger Token");
}
$strSQL="SELECT * FROM district";
$result = $db->query($strSQL);
$numCounter=1;
while ($row = $result->fetch(PDO::FETCH_ASSOC)) {
$strDistrict=$row['district'];
if (isset($_POST[$strDistrict])) {
$db->query("UPDATE `district` SET `active`= '1' WHERE `district`='$strDistrict'");
} else {
$db->query("UPDATE `district` SET `active`= '0' WHERE `district`='$strDistrict'");
}
}
header("Location: configuration.php");
//print_r($_POST);
?>