Tul xxx Tul
User / IP
:
216.73.216.217
Host / Server
:
45.84.207.204 / aircan.me
System
:
Linux lt-bnk-web1726.main-hosting.eu 5.14.0-611.36.1.el9_7.x86_64 #1 SMP PREEMPT_DYNAMIC Tue Mar 3 11:23:52 EST 2026 x86_64
Command
|
Upload
|
Create
Mass Deface
|
Jumping
|
Symlink
|
Reverse Shell
Ping
|
Port Scan
|
DNS Lookup
|
Whois
|
Header
|
cURL
:
/
home
/
u931257429
/
domains
/
aircan.me
/
public_html
/
vendefacil2
/
config
/
Viewing: Helpers.php
<?php function strClean($cadena) { $string = preg_replace(['/\s+/', '/^\s|\s$/'], [' ', ''], $cadena); $string = trim($string); $string = stripslashes($string); $string = str_ireplace('<script>', '', $string); $string = str_ireplace('</script>', '', $string); $string = str_ireplace('<script type=>', '', $string); $string = str_ireplace('<script src>', '', $string); $string = str_ireplace('SELECT * FROM', '', $string); $string = str_ireplace('DELETE FROM', '', $string); $string = str_ireplace('INSERT INTO', '', $string); $string = str_ireplace('SELECT COUNT(*) FROM', '', $string); $string = str_ireplace('DROP TABLE', '', $string); $string = str_ireplace("OR '1'='1", '', $string); $string = str_ireplace('OR ´1´=´1', '', $string); $string = str_ireplace('IS NULL', '', $string); $string = str_ireplace('LIKE "', '', $string); $string = str_ireplace("LIKE '", '', $string); $string = str_ireplace('LIKE ´', '', $string); $string = str_ireplace('OR "a"="a', '', $string); $string = str_ireplace("OR 'a'='a", '', $string); $string = str_ireplace('OR ´a´=´a', '', $string); $string = str_ireplace('--', '', $string); $string = str_ireplace('^', '', $string); $string = str_ireplace('[', '', $string); $string = str_ireplace(']', '', $string); $string = str_ireplace('==', '', $string); return $string; } function generate_numbers($start, $count, $digits) { $result = array(); for ($n = $start; $n < $start + $count; $n++) { $result[] = str_pad($n, $digits, "0", STR_PAD_LEFT); } return $result; } function verificar($valor) { $existe = array_search($valor, $_SESSION['permisos'], true); return is_numeric($existe); } function assetVersion($path) { $path = ltrim((string)$path, '/'); $fullPath = dirname(__DIR__) . DIRECTORY_SEPARATOR . str_replace(['/', '\\'], DIRECTORY_SEPARATOR, $path); $version = file_exists($fullPath) ? filemtime($fullPath) : time(); return BASE_URL . $path . '?v=' . $version; } function cartCajaItemMatches($product, $id, $caja_id, $lote_id = null) { $matches = intval($product['id']) === intval($id) && intval($product['caja_id']) === intval($caja_id); if (!$matches) { return false; } if ($lote_id === null) { return true; } return intval($product['lote_id'] ?? 0) === intval($lote_id); } function addToCartCaja($carrito, $id, $nombre, $precio, $discount = 0, $cant = 1, $caja_id = 0, $precios_venta = [], $precio_seleccionado = null, $foto = null, $extra = []) { if (!isset($_SESSION[$carrito])) { $_SESSION[$carrito] = []; } $cart = $_SESSION[$carrito]; $lote_id = isset($extra['lote_id']) ? intval($extra['lote_id']) : 0; $product = [ 'id' => intval($id), 'caja_id' => intval($caja_id), 'name' => $nombre, 'foto' => $foto, 'price' => $precio, 'discount' => $discount, 'quantity' => $cant, 'timestamp' => time(), 'precios_venta' => $precios_venta, 'precio_seleccionado' => $precio_seleccionado ?? ['monto' => $precio, 'nombre' => 'Precio default'] ]; if (!empty($extra)) { foreach ($extra as $key => $value) { $product[$key] = $value; } } // Verificar si el producto ya está en el carrito y actualizar la cantidad si es necesario $found = false; foreach ($cart as &$item) { if (cartCajaItemMatches($item, $id, $caja_id, $lote_id)) { if ((empty($item['foto']) || $item['foto'] === null) && !empty($foto)) { $item['foto'] = $foto; } $item['quantity'] += $cant; $found = true; break; } } if (!$found) { $cart[] = $product; } $_SESSION[$carrito] = $cart; return [ 'icono' => 'success', 'msg' => 'Producto agregado.' ]; } //Cantidad editable en el carrito function updateCantidadCaja($carrito, $id, $cantidad, $caja_id, $lote_id = null) { if (!isset($_SESSION[$carrito])) { // Manejar el caso en que el carrito no exista $response = [ 'icono' => 'error', 'msg' => 'El carrito no existe.' ]; return $response; } $cart = $_SESSION[$carrito]; $found = false; // Variable para verificar si se encontró el producto foreach ($cart as &$product) { // Verifica si el ID del producto y el ID de la caja coinciden if (cartCajaItemMatches($product, $id, $caja_id, $lote_id)) { $product['quantity'] = $cantidad; // Actualiza la cantidad $found = true; // Marca que se encontró el producto break; // Termina el ciclo ya que encontramos el producto } } // Si no se encontró el producto if (!$found) { $response = [ 'icono' => 'error', 'msg' => 'Producto no encontrado en la caja especificada.' ]; return $response; } $_SESSION[$carrito] = $cart; $response = [ 'icono' => 'success', 'msg' => 'Cantidad actualizada.' ]; return $response; } function updatePriceCaja($carrito, $id, $new_price_obj, $caja_id, $lote_id = null) { if (!isset($_SESSION[$carrito])) { return [ 'icono' => 'error', 'msg' => 'El carrito no existe.' ]; } $cart = &$_SESSION[$carrito]; $found = false; foreach ($cart as &$product) { if (cartCajaItemMatches($product, $id, $caja_id, $lote_id)) { // Actualizar precio base (monto) $product['price'] = $new_price_obj['monto']; // Guardar objeto precio completo $product['precio_seleccionado'] = $new_price_obj; $found = true; break; } } if (!$found) { return [ 'icono' => 'error', 'msg' => 'Producto no encontrado en la caja especificada.' ]; } return [ 'icono' => 'success', 'msg' => 'Precio actualizado.' ]; } function updateDiscountCaja($carrito, $id, $new_discount, $caja_id) { if (!isset($_SESSION[$carrito])) { // Manejar el caso en que el carrito no exista $response = [ 'icono' => 'error', 'msg' => 'El carrito no existe.' ]; return $response; } $cart = $_SESSION[$carrito]; $found = false; // Variable para verificar si se encontró el producto foreach ($cart as &$product) { // Verifica si el ID del producto y el ID de la caja coinciden if (intval($product['id']) === intval($id) && intval($product['caja_id']) === intval($caja_id)) { $product['discount'] = $new_discount; // Actualiza el precio $found = true; // Marca que se encontró el producto break; // Termina el ciclo ya que encontramos el producto } } // Si no se encontró el producto if (!$found) { $response = [ 'icono' => 'error', 'msg' => 'Producto no encontrado en la caja especificada.' ]; return $response; } $_SESSION[$carrito] = $cart; $response = [ 'icono' => 'success', 'msg' => 'Descuento actualizado.' ]; return $response; } function removeFromCartCaja($carrito, $id, $caja_id, $lote_id = null) { if (!isset($_SESSION[$carrito])) { $_SESSION[$carrito] = []; } $cart = $_SESSION[$carrito]; // Buscar el índice del producto en el carrito $productIndex = null; foreach ($cart as $index => $product) { // Verifica que el ID del producto y el ID de la caja coincidan if (cartCajaItemMatches($product, $id, $caja_id, $lote_id)) { $productIndex = $index; break; } } if ($productIndex !== null) { // Eliminar el producto del carrito unset($cart[$productIndex]); $_SESSION[$carrito] = array_values($cart); // Reindexar el array } // Preparar una respuesta JSON $response = [ 'icono' => 'success', 'msg' => 'Producto eliminado.' ]; return $response; } //COMPRA function addToCart($carrito, $id, $nombre, $precio, $cant = 1) { if (!isset($_SESSION[$carrito])) { $_SESSION[$carrito] = []; } $cart = $_SESSION[$carrito]; $product = [ 'id' => $id, 'name' => $nombre, 'price' => $precio, 'discount' => 0, 'timestamp' => time(), 'quantity' => $cant ]; // Verificar si el producto ya está en el carrito y actualizar la cantidad si es necesario $found = false; foreach ($cart as &$item) { if ($item['id'] === $id) { $item['quantity']++; $found = true; break; } } // Si no se encontró el producto en el carrito, agrégalo if (!$found) { $cart[] = $product; } $_SESSION[$carrito] = $cart; // Preparar una respuesta JSON $response = [ 'icono' => 'success', 'msg' => 'Producto agregado.' ]; return $response; } //ELIMINAR PRODUCTO DEL CARRITO function removeFromCart($carrito, $id) { if (!isset($_SESSION[$carrito])) { $_SESSION[$carrito] = []; } $cart = $_SESSION[$carrito]; // Buscar el índice del producto en el carrito $productIndex = null; foreach ($cart as $index => $product) { if (intval($product['id']) === intval($id)) { $productIndex = $index; break; } } if ($productIndex !== null) { // Eliminar el producto del carrito unset($cart[$productIndex]); $_SESSION[$carrito] = array_values($cart); // Reindexar el array } // Preparar una respuesta JSON $response = [ 'icono' => 'success', 'msg' => 'Producto eliminado.' ]; return $response; } //Vaciar productos del carrito function clearCart($carrito) { unset($_SESSION[$carrito]); // Eliminar el carrito de la sesión // Preparar una respuesta JSON $response = [ 'icono' => 'success', 'msg' => 'Carrito limpiado' ]; return $response; } //Mostrar el total general function getTotalPrice($tipo, $caja_id = null) { $total = 0; // Asegúrate de que la sesión esté inicializada if (!empty($_SESSION[$tipo])) { foreach ($_SESSION[$tipo] as $producto) { // Si se proporciona, suma solo los productos de esa caja if (is_null($caja_id) || $producto['caja_id'] == $caja_id) { $total += ($producto['price'] * $producto['quantity']) - $producto['discount']; } } } return $total; } //Cantidad editable en el carrito function updateCantidad($carrito, $id, $cantidad) { if (!isset($_SESSION[$carrito])) { // Manejar el caso en que el carrito no exista $response = [ 'icono' => 'error', 'msg' => 'El carrito no existe.' ]; return $response; } $cart = $_SESSION[$carrito]; foreach ($cart as &$product) { if (intval($product['id']) === intval($id)) { $product['quantity'] = $cantidad; break; } } $_SESSION[$carrito] = $cart; $response = [ 'icono' => 'success', 'msg' => 'Cantidad actualizada.' ]; return $response; } //Precio editable en el carrito function updatePrice($carrito, $id, $new_price) { if (!isset($_SESSION[$carrito])) { // Manejar el caso en que el carrito no exista $response = [ 'icono' => 'error', 'msg' => 'El carrito no existe.' ]; return $response; } $cart = $_SESSION[$carrito]; foreach ($cart as &$product) { if (intval($product['id']) == $id) { $product['price'] = $new_price; break; } } $_SESSION[$carrito] = $cart; $response = [ 'icono' => 'success', 'msg' => 'Precio actualizado.' ]; return $response; } function mmToPoints($mm) { return $mm * 2.83464567; } function formatFechaHora($fecha, $hora = null, $format = 'd/m/Y h:i A') { $fecha = trim((string)$fecha); $hora = trim((string)$hora); if ($fecha === '') { return date($format); } if ($hora !== '') { $value = trim($fecha . ' ' . $hora); $ts = strtotime($value); return ($ts === false) ? date($format) : date($format, $ts); } if (preg_match('/\d{2}:\d{2}/', $fecha) === 1) { $ts = strtotime($fecha); return ($ts === false) ? date($format) : date($format, $ts); } $value = trim($fecha . ' ' . date('H:i:s')); $ts = strtotime($value); return ($ts === false) ? date($format) : date($format, $ts); } function whatsappNormalizePhone(string $phone): string { $digits = preg_replace('/\D+/', '', $phone); return $digits ?? ''; } function whatsappCloudSendTextMessage(string $to, string $body): array { if (!defined('WHATSAPP_CLOUD_TOKEN') || !defined('WHATSAPP_CLOUD_PHONE_NUMBER_ID')) { return ['ok' => false, 'error' => 'Whatsapp no configurado']; } $token = (string)WHATSAPP_CLOUD_TOKEN; $phoneNumberId = (string)WHATSAPP_CLOUD_PHONE_NUMBER_ID; if ($token === '' || $phoneNumberId === '') { return ['ok' => false, 'error' => 'Whatsapp no configurado']; } if (!function_exists('curl_init')) { return ['ok' => false, 'error' => 'cURL no disponible']; } $to = whatsappNormalizePhone($to); if ($to === '') { return ['ok' => false, 'error' => 'Número inválido']; } $url = 'https://graph.facebook.com/v21.0/' . rawurlencode($phoneNumberId) . '/messages'; $payload = [ 'messaging_product' => 'whatsapp', 'to' => $to, 'type' => 'text', 'text' => [ 'preview_url' => false, 'body' => $body, ], ]; $ch = curl_init($url); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); curl_setopt($ch, CURLOPT_POST, true); curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 4); curl_setopt($ch, CURLOPT_TIMEOUT, 8); curl_setopt($ch, CURLOPT_HTTPHEADER, [ 'Authorization: Bearer ' . $token, 'Content-Type: application/json', ]); curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($payload, JSON_UNESCAPED_UNICODE)); $raw = curl_exec($ch); $curlErr = curl_error($ch); $httpCode = (int)curl_getinfo($ch, CURLINFO_HTTP_CODE); curl_close($ch); if ($raw === false) { return ['ok' => false, 'error' => $curlErr ?: 'Error desconocido']; } $json = json_decode($raw, true); if ($httpCode >= 200 && $httpCode < 300) { return ['ok' => true, 'data' => $json]; } return ['ok' => false, 'error' => $json['error']['message'] ?? 'Error HTTP ' . $httpCode, 'data' => $json]; } function whatsappBuildPedidoWebMessage( int $pedidoId, array $cliente, array $productos, float $total, string $moneda, string $fecha, string $hora ): string { $empresa = defined('TITLE') ? (string)TITLE : 'Tienda'; $fechaFmt = formatFechaHora($fecha, $hora, 'd/m/Y h:i A'); $lines = []; $lines[] = '*' . $empresa . '*'; $lines[] = '*Nuevo pedido web*'; $lines[] = '------------------------------'; $lines[] = '*Cliente*'; $lines[] = 'Nombre: ' . ($cliente['nombre'] ?? ''); $lines[] = 'Teléfono: ' . ($cliente['telefono'] ?? ''); $identidad = trim((string)($cliente['identidad'] ?? '')); $numIdentidad = trim((string)($cliente['num_identidad'] ?? '')); if ($identidad !== '' || $numIdentidad !== '') { $lines[] = 'Documento: ' . trim($identidad . ' ' . $numIdentidad); } if (!empty($cliente['correo'])) { $lines[] = 'Correo: ' . $cliente['correo']; } if (!empty($cliente['direccion'])) { $lines[] = 'Dirección: ' . $cliente['direccion']; } if (!empty($cliente['nota'])) { $lines[] = 'Nota: ' . $cliente['nota']; } $lines[] = '------------------------------'; $lines[] = '*Productos*'; $i = 1; foreach ($productos as $p) { $nombre = (string)($p['nombre'] ?? ''); $cantidad = (int)($p['cantidad'] ?? 0); $precio = (float)($p['precio'] ?? 0); $sub = $precio * $cantidad; $lines[] = $i . ') ' . $nombre; $lines[] = ' ' . $cantidad . ' x ' . $moneda . ' ' . number_format($precio, 2, ',', '.') . ' = ' . $moneda . ' ' . number_format($sub, 2, ',', '.'); $i++; } $lines[] = '------------------------------'; $lines[] = '*Total:* ' . $moneda . ' ' . number_format($total, 2, ',', '.'); return implode("\n", $lines); } function whatsappNotifyPedidoWeb( int $pedidoId, array $cliente, array $productos, float $total, string $moneda, string $fecha, string $hora ): array { if (!defined('WHATSAPP_ADMIN_TO')) { return ['ok' => false, 'error' => 'Whatsapp no configurado']; } $to = (string)WHATSAPP_ADMIN_TO; $msg = whatsappBuildPedidoWebMessage($pedidoId, $cliente, $productos, $total, $moneda, $fecha, $hora); return whatsappCloudSendTextMessage($to, $msg); }
Coded With 💗 by
0x6ick