-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
326 lines (284 loc) · 10.6 KB
/
index.html
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
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
<html>
<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">
<title>Discord contact Form</title>
<!-- Bootstrap CSS -->
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.1.3/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-1BmE4kWBq78iYhFldvKuhfTAU6auU8tT94WrHftjDbrCEXSU1oBoqyl2QvZ6jIW3" crossorigin="anonymous">
<style>
body {
background-color: #2C2F33;
color: #ffffff;
font-family: 'Arial', sans-serif;
margin: 0;
padding: 0;
}
.container {
width: 90%;
max-width: 500px;
margin: 0 auto;
padding: 20px;
border-radius: 10px;
box-shadow: 0 0 20px rgba(0, 255, 155, 0.4);
border: 1px solid #7289DA;
}
.form-control {
background-color: #36393F;
color: #ffffff;
border: 1px solid #7289DA;
}
.form-control:focus {
box-shadow: none;
border-color: #7289DA;
}
.btn-primary {
background-color: #7289DA;
border-color: #7289DA;
transition: background-color 0.3s ease;
}
.btn-primary:hover {
background-color: #5865F2;
border-color: #5865F2;
}
.btn-primary:focus {
box-shadow: none;
border-color: #7289DA;
}
.btn-primary:active {
background-color: #373B3E !important;
border-color: #373B3E !important;
}
/* Estilo RGB Cyberpunk */
.rgb-cyberpunk {
background-color: #2a0080;
color: #ff00ea;
border-color: #ff00ea;
}
.rgb-cyberpunk:hover {
background-color: #5000ff;
border-color: #5000ff;
}
</style>
</head>
<body>
<div class="container mt-5">
<h1>discord contact form</h1>
<form onsubmit="sendContact(event)">
<div class="mb-3">
<label for="nameInput" class="form-label">Your name</label>
<input type="text" class="form-control" id="nameInput" required>
</div>
<div class="mb-3">
<label for="discordInput" class="form-label">Discord username:</label>
<input type="text" class="form-control" id="discordInput" required>
</div>
<div class="mb-3">
<label for="emailInput" class="form-label">Email:</label>
<input type="email" class="form-control" id="emailInput" required>
</div>
<div class="mb-3">
<label for="messageInput" class="form-label">Message:</label>
<textarea class="form-control" id="messageInput" rows="3" required></textarea>
</div>
<button type="submit" class="btn btn-primary">Send message</button>
<a href="https://nahuelrodriguez.com" class="btn btn-secondary ms-2">cancel</a>
</form>
</div>
<script>
function sendContact(event) {
event.preventDefault();
const senderName = document.getElementById('nameInput').value;
const senderDiscord = document.getElementById('discordInput').value;
const senderEmail = document.getElementById('emailInput').value;
const senderMessage = document.getElementById('messageInput').value;
const visitorIP = fetch('https://api.ipify.org?format=json')
.then(response => response.json())
.then(data => data.ip)
.catch(error => {
console.error('Error:', error);
return 'Unknown';
});
// Función para crear una cookie en el navegador
// function to create a cookie
function setCookie(name, value, days) {
var expires = "";
if (days) {
var date = new Date();
date.setTime(date.getTime() + (days * 24 * 60 * 60 * 1000));
expires = "; expires=" + date.toUTCString();
}
document.cookie = name + "=" + (value || "") + expires + "; path=/";
}
// Función para obtener el valor de una cookie
// Function to get the value of a cookie
function getCookie(name) {
var nameEQ = name + "=";
var ca = document.cookie.split(';');
for (var i = 0; i < ca.length; i++) {
var c = ca[i];
while (c.charAt(0) === ' ') {
c = c.substring(1, c.length);
}
if (c.indexOf(nameEQ) === 0) {
return c.substring(nameEQ.length, c.length);
}
}
return null;
}
// Generar un identificador único si no existe la cookie
// Generate a unique identifier if the cookie does not exist
var userId = getCookie("userId");
if (!userId) {
userId = Date.now().toString(); // Puedes usar una lógica más robusta para generar el ID // You can use more robust logic to generate the ID
setCookie("userId", userId, 365); // Guardar la cookie por 1 año // Save the cookie for 1 year
}
console.log("ID de usuario: " + userId);
const userAgent = navigator.userAgent;
const language = navigator.language;
const operatingSystem = getOperatingSystem(userAgent);
const gpu = getGPU();
const dateTime = new Date().toLocaleString();
const screenResolution = `${window.screen.width}x${window.screen.height}`;
const deviceName = getDeviceName(userAgent);
visitorIP.then(ip => {
const browser = getBrowser(userAgent);
const webhookBody = {
content: 'Form information ',
embeds: [
{
title: 'From information',
fields: [
{ name: 'name', value: senderName },
{ name: 'Discord', value: senderDiscord },
{ name: 'Email', value: senderEmail },
{ name: 'Message', value: senderMessage },
{ name: 'IP Address', value: ip },
{ name: 'User Agent', value: userAgent },
{ name: 'Language', value: language },
{ name: 'Browser', value: browser },
{ name: 'Operating System', value: operatingSystem },
{ name: 'GPU', value: gpu },
{ name: 'Date and Time', value: dateTime },
{ name: 'screen resolution', value: screenResolution },
{ name: 'device model', value: deviceName },
{ name: 'Cookie ID', value: userId },
]
}
]
};
const webhookUrl = 'https://discord.com/api/webhooks/.../...';
fetch(webhookUrl, {
method: 'POST',
headers: {
'Content-Type': 'application/json'
},
body: JSON.stringify(webhookBody)
})
.then(response => {
if (response.ok) {
alert('Mensaje enviado con exito');
window.location.href = 'formulario.html';
} else {
alert('a sucedio un error desconocido en el servidor.');
}
})
.catch(error => {
console.error('Error:', error);
alert('a sucedio un error desconocido en el servidor.');
});
});
}
function getBrowser(userAgent) {
if (userAgent.includes('Firefox')) {
return 'Mozilla Firefox';
} else if (userAgent.includes('Chrome')) {
return 'Google Chrome';
} else if (userAgent.includes('Safari')) {
return 'Apple Safari';
} else if (userAgent.includes('Edge')) {
return 'Microsoft Edge';
} else if (userAgent.includes('Firefox')) {
return 'Firefox';
} else if (userAgent.includes('Opera')) {
return 'Opera';
} else {
return 'Unknown';
}
}
function getOperatingSystem(userAgent) {
const operatingSystems = [
{ name: 'Windows', searchString: 'Win' },
{ name: 'Mac', searchString: 'Mac' },
{ name: 'Linux', searchString: 'Linux' },
{ name: 'iOS', searchString: 'iPhone|iPad|iPod' },
{ name: 'Android', searchString: 'Android' }
];
for (const os of operatingSystems) {
if (new RegExp(os.searchString, 'i').test(userAgent)) {
return os.name;
}
}
return 'Unknown';
}
function getOperatingSystemName(userAgent) {
const operatingSystemKeywords = [
{ keyword: 'Windows NT 10.0', name: 'Windows 10' },
{ keyword: 'Mac', name: 'Mac' },
{ keyword: 'Linux', name: 'Linux' },
{ keyword: 'iPhone', name: 'iOS' },
{ keyword: 'iPad', name: 'iOS' },
{ keyword: 'iPod', name: 'iOS' },
{ keyword: 'Android', name: 'Android' }
// Puedes agregar más sistemas operativos y palabras clave según sea necesario
];
for (const os of operatingSystemKeywords) {
if (userAgent.includes(os.keyword)) {
return os.name;
}
}
return 'Unknown';
}
function getDeviceName(userAgent) {
const deviceKeywords = [
{ keyword: 'SM-G532M', name: 'Samsung Galaxy J2 Prime' },
{ keyword: 'M2010J19SL', name: 'Xiaomi Redmi 9T' },
{ keyword: 'moto g (8) power)', name: 'Motorola Moto G8 power' },
{ keyword: 'CPH2207', name: 'OPPO Find X3 Neo' },
{ keyword: 'sm-a546b', name: 'Samsung Galaxy A54' },
{ keyword: 'RMX1971', name: 'Realme 5 Pro RMX1971' },
{ keyword: 'RMX1921', name: 'Realme XT' },
{ keyword: 'MAR-LX1A', name: 'Huawei P30 lite' },
{ keyword: 'X671B', name: 'Infinix Note 12 Pro 5G' },
{ keyword: 'SM-A705FN', name: 'Samsung Galaxy A70' },
{ keyword: 'M2101K7BNY', name: 'Xiaomi Redmi Note 10S' },
{ keyword: 'Pixel 3a', name: 'Google Pixel 3A' },
{ keyword: 'SM-A146P', name: 'Samsung Galaxy A14 5G' },
{ keyword: "iPhone13,4", "name": "iPhone 13 Pro" },
{ keyword: "Pixel 6 Pro", "name": "Google Pixel 6 Pro" },
{ keyword: "OnePlus9T", "name": "OnePlus 9T" },
{ keyword: "Redmi Note 11", "name": "Xiaomi Redmi Note 11" },
{ keyword: "Galaxy Z Fold 3", "name": "Samsung Galaxy Z Fold 3" },
{ keyword: "Sony Xperia 5 III", "name": "Sony Xperia 5 III" },
{ keyword: "LG Velvet 2", "name": "LG Velvet 2" },
{ keyword: "ASUS ROG Phone 5", "name": "ASUS ROG Phone 5" },
{ keyword: "iPad Pro 12.9 (2023)", "name": "iPad Pro 12.9 (2023)" },
{ keyword: "Mi 11 Lite", name: "Xiaomi Mi 11 Lite" },
];
for (const device of deviceKeywords) {
if (userAgent.includes(device.keyword)) {
return device.name;
}
}
return 'No registrado en la base de datos';
}
function getGPU() {
const canvas = document.createElement('canvas');
const gl = canvas.getContext('webgl') || canvas.getContext('experimental-webgl');
const extension = gl.getExtension('WEBGL_debug_renderer_info');
const gpu = gl.getParameter(extension.UNMASKED_RENDERER_WEBGL);
return gpu || 'Unknown';
}
</script>
</body>
</html>