mirror of
http://git.frickel.earth/Tysox/BOS-Pinneberg.git
synced 2025-12-15 22:34:22 +01:00
added adding in Admin Panel
This commit is contained in:
77
admin/scripts/vehicle.php
Normal file
77
admin/scripts/vehicle.php
Normal file
@@ -0,0 +1,77 @@
|
||||
<?php
|
||||
session_start();
|
||||
if (empty($_SESSION['status'])) {
|
||||
if (!file_exists('config/config.inc.php')) {
|
||||
$_SESSION['status'] = 'error';
|
||||
} else {
|
||||
$_SESSION['status'] = 'login';
|
||||
}
|
||||
}
|
||||
|
||||
if ($_SESSION['status'] == "login") {
|
||||
echo "<html>
|
||||
<head>
|
||||
<script>
|
||||
setTimeout(\"window.location.href='../login.php'\", 0);
|
||||
</script>
|
||||
</head>
|
||||
<body>
|
||||
</body>
|
||||
</html>";
|
||||
return;
|
||||
}
|
||||
|
||||
include '../config/config.inc.php';
|
||||
$data = new Config();
|
||||
|
||||
try {
|
||||
$pdo = new PDO('mysql:host=' . $data->getSQLHost() . ';dbname=' . $data->getSQLDatabase() . ';charset=utf8mb4', $data->getSQLUser(), $data->getSQLPassword());
|
||||
} catch (PDOException $exception) {
|
||||
echo "Fehler: " . $exception->getMessage();
|
||||
exit;
|
||||
}
|
||||
|
||||
if ($_POST) {
|
||||
|
||||
if (isset($_POST['org'])) {
|
||||
|
||||
if(strcmp($_POST['org'], "ff")) {
|
||||
if (isset($_POST['ort']) && isset($_POST['name']) && isset($_POST['number']) && isset($_POST['type'])) {
|
||||
$insert = $pdo->prepare("INSERT INTO feuerwehr (id, OrtID, Organistationskennung, Fahrzeugkennung, Fahrzeugtyp) VALUES (?,?,?,?,?)");
|
||||
|
||||
$select = $pdo->prepare("SELECT COUNT(OrtID) FROM feuerwehr WHERE OrtID = ?");
|
||||
if ($select->execute(array($_POST ['ort']))) {
|
||||
$count = $select->fetch();
|
||||
|
||||
if ($count <= 9) {
|
||||
$count = $_POST['ort'] . "0" . $count;
|
||||
} else {
|
||||
$count = $_POST['ort'] . $count;
|
||||
}
|
||||
}
|
||||
$insert->bindParam(1, $count);
|
||||
$insert->bindParam(2, $_POST['ort']);
|
||||
$insert->bindParam(3, $_POST['name']);
|
||||
$insert->bindParam(4, $_POST['number']);
|
||||
$insert->bindParam(5, $_POST['type']);
|
||||
$insert->execute();
|
||||
echo "Eintrag vom Fahrzeug erfolgreich";
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if(strcmp($_POST['org'], "pol")) {
|
||||
|
||||
}
|
||||
|
||||
if(strcmp($_POST['org'], "rt")) {
|
||||
|
||||
}
|
||||
|
||||
if(strcmp($_POST['org'], "thw")) {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
?>
|
||||
Reference in New Issue
Block a user