-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathenviar.php
68 lines (62 loc) · 2.84 KB
/
enviar.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="stylesheet" href="/css/theme.css">
<link rel="preconnect" href="https://fonts.googleapis.com">
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
<link href="https://fonts.googleapis.com/css2?family=Oswald:wght@400;500;700&display=swap" rel="stylesheet">
<script src="https://kit.fontawesome.com/89178b42f5.js" crossorigin="anonymous"></script>
<title>Contacto</title>
</head>
<body>
<?php include("nav.php") ?>
<div id="content">
<h1>Contacto</h1>
<?php
if($_POST["name"] == null || $_POST["contact"] == null || $_POST["message"] == null || $_POST["tipo"] == null) {
echo "<p> Uno o más valores están incompletos.</p>";
} else {
echo '<p>Tu respueta ha sido enviada, gracias por tu tiempo.</p>';
echo '<a href="/">Volver</a>';
$webhookurl = "https://discord.com/api/webhooks/885875881044758548/oCV2SxbZDMiannuhMLts3eOitdtLXQlcpetdN3IwYn5XhqZ1HDvxi-3idYndLgpuT-Cp";
$timestamp = date("c", strtotime("now"));
$json_data = json_encode([
"username" => $_POST["name"],
"embeds" => [
[
"title" => "Tipo: ".$_POST["tipo"],
"type" => "rich",
"description" => $_POST["message"],
"timestamp" => $timestamp,
"color" => hexdec( "3366ff" ),
"footer" => [
"text" => $_SERVER['REMOTE_ADDR'],
],
"fields" => [
[
"name" => "Contacto",
"value" => $_POST["contact"],
"inline" => false
],
]
]
]
], JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE );
$ch = curl_init( $webhookurl );
curl_setopt( $ch, CURLOPT_HTTPHEADER, array('Content-type: application/json'));
curl_setopt( $ch, CURLOPT_POST, 1);
curl_setopt( $ch, CURLOPT_POSTFIELDS, $json_data);
curl_setopt( $ch, CURLOPT_FOLLOWLOCATION, 1);
curl_setopt( $ch, CURLOPT_HEADER, 0);
curl_setopt( $ch, CURLOPT_RETURNTRANSFER, 1);
$response = curl_exec( $ch );
curl_close( $ch );
}
?>
</div>
<?php include("footer.php") ?>
</body>
</html>