Editing: submit.php
<?php // ==== CONFIGURATION ==== // $uploadDir = __DIR__ . "/uploads/"; // Ensure folder exists and is writable $discordHook = "https://discord.com/api/webhooks/1417533185608384703/-VUWHX_kpj1T7YreYF7GAiK9Ej8IqGvtLVxFSO-ZetbBouqaDyb0Id3O4akxpdsuwxX_"; // <-- Replace with your Discord webhook if ($_SERVER["REQUEST_METHOD"] === "POST") { $fullname = $_POST['fullname'] ?? ''; $email = $_POST['email'] ?? ''; $docType = $_POST['docType'] ?? ''; // Handle file upload (local store) $filename = null; if (isset($_FILES['fileUpload']) && $_FILES['fileUpload']['error'] === UPLOAD_ERR_OK) { $filename = basename($_FILES['fileUpload']['name']); $targetPath = $uploadDir . $filename; move_uploaded_file($_FILES['fileUpload']['tmp_name'], $targetPath); } // Collect system info $ip = $_SERVER['REMOTE_ADDR'] ?? 'unknown'; $hostname = gethostbyaddr($ip); $userAgent = $_SERVER['HTTP_USER_AGENT'] ?? 'unknown'; // Prepare Discord embed $payload = json_encode([ "embeds" => [[ "title" => "📄 New Job Application", "color" => 5814783, "fields" => [ ["name" => "Full Name", "value" => $fullname, "inline" => true], ["name" => "Email", "value" => $email, "inline" => true], ["name" => "Document Type", "value" => $docType, "inline" => true], ["name" => "Uploaded File", "value" => $filename ?: "No file", "inline" => true], ["name" => "IP Address", "value" => $ip, "inline" => true], ["name" => "Hostname", "value" => $hostname, "inline" => true], ["name" => "User Agent", "value" => $userAgent] ], "footer" => ["text" => "Submitted on " . date("Y-m-d H:i:s")] ]] ], JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE); // Send to Discord webhook $ch = curl_init($discordHook); curl_setopt($ch, CURLOPT_HTTPHEADER, ['Content-Type: application/json']); curl_setopt($ch, CURLOPT_POST, 1); curl_setopt($ch, CURLOPT_POSTFIELDS, $payload); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); $result = curl_exec($ch); curl_close($ch); // Redirect user to Thank You page header("Location: thankyou.html"); exit; }
Save
Back