heler/helfer-to-DocuSeal.php gelöscht
This commit is contained in:
@@ -1,91 +0,0 @@
|
|||||||
<?php
|
|
||||||
session_start();
|
|
||||||
if ($_SERVER['REQUEST_METHOD'] !== 'POST' || !empty($_POST['website_hp'])) {
|
|
||||||
http_response_code(403);
|
|
||||||
die("Ungültige Anfrage.");
|
|
||||||
}
|
|
||||||
if (isset($_SESSION['last_sub_vol']) && (time() - $_SESSION['last_sub_vol'] < 5)) {
|
|
||||||
http_response_code(429);
|
|
||||||
die("Anfrage zu schnell.");
|
|
||||||
}
|
|
||||||
$_SESSION['last_sub_vol'] = time();
|
|
||||||
if (isset($_POST['discord_role']) && !empty($_POST['discord_name'])) {
|
|
||||||
$payload = json_encode([
|
|
||||||
'discord_name' => $_POST['discord_name'],
|
|
||||||
'discord_role' => true
|
|
||||||
]);
|
|
||||||
$ch = curl_init('URL EINFÜGEN');
|
|
||||||
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
|
|
||||||
curl_setopt($ch, CURLOPT_POST, true);
|
|
||||||
curl_setopt($ch, CURLOPT_POSTFIELDS, $payload);
|
|
||||||
curl_setopt($ch, CURLOPT_TIMEOUT, 10);
|
|
||||||
curl_setopt($ch, CURLOPT_HTTPHEADER, [
|
|
||||||
'Content-Type: application/json',
|
|
||||||
'Authorization: (AuthKEY einfügen)'
|
|
||||||
]);
|
|
||||||
|
|
||||||
curl_exec($ch);
|
|
||||||
$http_code = curl_getinfo($ch, CURLINFO_HTTP_CODE);
|
|
||||||
curl_close($ch);
|
|
||||||
file_put_contents('bot_debug.log', "Code: $http_code | Error: $error | Resp: $response" . PHP_EOL, FILE_APPEND);
|
|
||||||
usleep(500000);
|
|
||||||
}
|
|
||||||
$api_key = '(APIKEY EINFPÜGEN)';
|
|
||||||
$template_id = 1;
|
|
||||||
$geburtsdatum_raw = $_POST['geburtstag'] ?? '';
|
|
||||||
$date_obj = DateTime::createFromFormat('d.m.Y', $geburtsdatum_raw);
|
|
||||||
$geburtsdatum_iso = $date_obj ? $date_obj->format('Y-m-d') : $geburtsdatum_raw;
|
|
||||||
|
|
||||||
$tage = $_POST['tage'] ?? [];
|
|
||||||
$bereiche = $_POST['bereiche'] ?? [];
|
|
||||||
|
|
||||||
$fields = [
|
|
||||||
["name" => "Vorname", "value" => $_POST['vorname'] ?? ''],
|
|
||||||
["name" => "Nachname", "value" => $_POST['nachname'] ?? ''],
|
|
||||||
["name" => "Geburtstag", "value" => $geburtsdatum_iso],
|
|
||||||
["name" => "T-Shirt", "value" => $_POST['tshirt'] ?? ''],
|
|
||||||
["name" => "Strasse", "value" => $_POST['strasse'] ?? ''],
|
|
||||||
["name" => "PLZ_Ort", "value" => $_POST['plz_ort'] ?? ''],
|
|
||||||
["name" => "Email", "value" => $_POST['email'] ?? ''],
|
|
||||||
["name" => "Handy", "value" => $_POST['handy'] ?? ''],
|
|
||||||
["name" => "Notfallkontakt", "value" => $_POST['notfall'] ?? ''],
|
|
||||||
["name" => "Essen", "value" => $_POST['essen'] ?? ''],
|
|
||||||
["name" => "Faehigkeiten", "value" => $_POST['skills'] ?? ''],
|
|
||||||
["name" => "Allergie_Vorhanden", "value" => (!empty($_POST['allergien'])) ? "true" : "false"],
|
|
||||||
["name" => "Allergien_Text", "value" => $_POST['allergien'] ?? ''],
|
|
||||||
["name" => "Einwilligung_Checkbox", "value" => isset($_POST['einwilligung']) ? "true" : "false"],
|
|
||||||
["name" => "WhatsApp_Checkbox", "value" => isset($_POST['whatsapp']) ? "true" : "false"],
|
|
||||||
["name" => "Tag_Fr", "value" => in_array("Fr", $tage) ? "true" : "false"],
|
|
||||||
["name" => "Tag_Sa", "value" => in_array("Sa", $tage) ? "true" : "false"],
|
|
||||||
["name" => "Bereich_Kasse", "value" => in_array("Kasse", $bereiche) ? "true" : "false"],
|
|
||||||
["name" => "Bereich_Security", "value" => in_array("Security", $bereiche) ? "true" : "false"],
|
|
||||||
["name" => "Bereich_Info", "value" => in_array("Info", $bereiche) ? "true" : "false"],
|
|
||||||
["name" => "Bereich_Catering", "value" => in_array("Catering", $bereiche) ? "true" : "false"],
|
|
||||||
["name" => "Bereich_Technik", "value" => in_array("Technik", $bereiche) ? "true" : "false"],
|
|
||||||
["name" => "Bereich_Springer", "value" => in_array("Springer", $bereiche) ? "true" : "false"]
|
|
||||||
];
|
|
||||||
|
|
||||||
$data = [
|
|
||||||
"template_id" => (int)$template_id,
|
|
||||||
"send_email" => false,
|
|
||||||
"submitters" => [[
|
|
||||||
"role" => "Helfer",
|
|
||||||
"email" => $_POST['email'] ?? '',
|
|
||||||
"fields" => $fields
|
|
||||||
]]
|
|
||||||
];
|
|
||||||
$ch = curl_init('(Link einfügen)');
|
|
||||||
curl_setopt($ch, CURLOPT_HTTPHEADER, ['X-Auth-Token: ' . $api_key, 'Content-Type: application/json']);
|
|
||||||
curl_setopt($ch, CURLOPT_POST, 1);
|
|
||||||
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($data));
|
|
||||||
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
|
|
||||||
$response = curl_exec($ch);
|
|
||||||
$result = json_decode($response, true);
|
|
||||||
curl_close($ch);
|
|
||||||
if (isset($result[0]['slug'])) {
|
|
||||||
header("Location: (Link einfügen)" . $result[0]['slug']);
|
|
||||||
exit();
|
|
||||||
} else {
|
|
||||||
die("API Fehler: " . htmlspecialchars($response));
|
|
||||||
}
|
|
||||||
?>
|
|
||||||
Reference in New Issue
Block a user