|
@@ -274,6 +274,25 @@ function getDiscordUserGuilds($access_token)
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+function sendDcMessage($webook, $message)
|
|
|
|
+{
|
|
|
|
+ $ch = curl_init();
|
|
|
|
+ curl_setopt_array($ch, [
|
|
|
|
+ CURLOPT_URL => $webhook,
|
|
|
|
+ CURLOPT_POST => true,
|
|
|
|
+ CURLOPT_POSTFIELDS => $message,
|
|
|
|
+ CURLOPT_HTTPHEADER => [
|
|
|
|
+ "Content-Type: application/json"
|
|
|
|
+ ]
|
|
|
|
+ ]);
|
|
|
|
+ $response = curl_exec($ch);
|
|
|
|
+ curl_close($ch);
|
|
|
|
+ if ($response == 1) {
|
|
|
|
+ return $response;
|
|
|
|
+ }
|
|
|
|
+ return "Error: Issue sending message";
|
|
|
|
+}
|
|
|
|
+
|
|
if ($_SERVER["REQUEST_METHOD"] == "POST") {
|
|
if ($_SERVER["REQUEST_METHOD"] == "POST") {
|
|
if (isset($_POST["delete"])) {
|
|
if (isset($_POST["delete"])) {
|
|
print_r($_POST["delete"]);
|
|
print_r($_POST["delete"]);
|
|
@@ -325,6 +344,44 @@ if ($_SERVER["REQUEST_METHOD"] == "POST") {
|
|
$birthDate = $conn->escapeString($birthDate);
|
|
$birthDate = $conn->escapeString($birthDate);
|
|
$submitTime = $conn->escapeString(date("Y-m-d\TH:i:s"));
|
|
$submitTime = $conn->escapeString(date("Y-m-d\TH:i:s"));
|
|
if ($conn->query("INSERT INTO empyreanrealm (nickname, discord, username, birthdate, submittime) VALUES (?,?,?,?,?)", $nickname, $discordUsername, $username, $birthDate, $submitTime)->affectedRows() === 1) {
|
|
if ($conn->query("INSERT INTO empyreanrealm (nickname, discord, username, birthdate, submittime) VALUES (?,?,?,?,?)", $nickname, $discordUsername, $username, $birthDate, $submitTime)->affectedRows() === 1) {
|
|
|
|
+ $message = json_encode([
|
|
|
|
+ "username" => "Bedrock Applications",
|
|
|
|
+ "avatar_url" => siteUrl."/source/logo.png",
|
|
|
|
+ "embeds" => [
|
|
|
|
+ [
|
|
|
|
+ "title" => "New Bedrock Application",
|
|
|
|
+ "type" => "rich",
|
|
|
|
+ "description" => "$nickname has applied to the bedrock server.",
|
|
|
|
+ "timestamp" => date("Y-m-d\TH:i:s"),
|
|
|
|
+ "url" => siteUrl."/applications",
|
|
|
|
+ "color" => hexdec("55C9F6"),
|
|
|
|
+ "fields" => [
|
|
|
|
+ [
|
|
|
|
+ "name" => "Nickname",
|
|
|
|
+ "value" => "$nickname",
|
|
|
|
+ "inline" => true
|
|
|
|
+ ],
|
|
|
|
+ [
|
|
|
|
+ "name" => "Bedrock Username",
|
|
|
|
+ "value" => "$username",
|
|
|
|
+ "inline" => true
|
|
|
|
+ ],
|
|
|
|
+ [
|
|
|
|
+ "name" => "Discord Username",
|
|
|
|
+ "value" => "$discordUsername",
|
|
|
|
+ "inline" => true
|
|
|
|
+ ],
|
|
|
|
+ [
|
|
|
|
+ "name" => "Birth Date",
|
|
|
|
+ "value" => "$birthDate",
|
|
|
|
+ "inline" => true
|
|
|
|
+ ]
|
|
|
|
+ ]
|
|
|
|
+ ]
|
|
|
|
+ ]
|
|
|
|
+
|
|
|
|
+ ], JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE);
|
|
|
|
+ sendDcMessage(discordWebhook, $message);
|
|
$success = true;
|
|
$success = true;
|
|
} else {
|
|
} else {
|
|
$errors[] = "Error submitting form.";
|
|
$errors[] = "Error submitting form.";
|