Untitled

mail@pastecode.io avatar
unknown
php
7 months ago
13 kB
2
Indexable
Never
<?php
    
    // Include database configuration file
    include '../connections/functions.inc.php';
    
    // Check if all required POST data is set
    if (isset($_POST['auth_name']) && isset($_POST['auth_email']) && isset($_POST['auth_tel']) && isset($_POST['auth_currency']) && isset($_POST['auth_country']) && isset($_POST['auth_passkey']) && isset($_POST['auth_passkey_confirm'])) {
    
        // Sanitize and store POST data
        $ref = sanitizeInput($_POST['auth_ref']);
        $name = sanitizeInput($_POST['auth_name']);
        $email = sanitizeInput($_POST['auth_email']);
        $tel = sanitizeInput($_POST['auth_tel']);
        $currency = sanitizeInput($_POST['auth_currency']);
        $country = sanitizeInput($_POST['auth_country']);
        $password = sanitizeInput($_POST['auth_passkey']);
        $password_confirm = sanitizeInput($_POST['auth_passkey_confirm']);
    
        // Generate Email Verification Token
        $verify_code = generateEmailVerificationToken();
    
        // Generate a unique referral ID
        $referralID = generateReferralID(10);
    
        // Get the current date and time
        $join_date = date('Y-m-d H:i:s');
    
        // Validate and sanitize user name
        $validatedName = validateAndSanitizeName($name);
    
        // Email subject for verification email
        $subject = ''.$GLOBALS['system_name'].' - Verify your Email Address!';
    
        // HTML content for the verification email
        $message = '<!DOCTYPE html>
        <html lang="en">
        <head>
            <meta charset="UTF-8">
            <meta name="viewport" content="width=device-width, initial-scale=1.0">
            <title>Welcome to '.$GLOBALS['system_name'].' - Verify your Email Address!</title>
            <style>
                /* Add your custom CSS styles here */
    
                body {
                    font-family: Arial, sans-serif;
                    background-color: #f5f5f5;
                    margin: 0;
                    padding: 0;
                }
    
                .container {
                    max-width: 600px;
                    margin: 0 auto;
                    background-color: #ffffff;
                    padding: 20px;
                    border-radius: 10px;
                    box-shadow: 0px 0px 20px rgba(0, 0, 0, 0.1);
                }
    
                h1 {
                    color: #333;
                    font-size: 24px;
                    margin-bottom: 20px;
                }
    
                p {
                    color: #666;
                    font-size: 16px;
                    line-height: 1.5;
                    margin-bottom: 10px;
                }
    
                .cta-button {
                    display: inline-block;
                    background-color: #7367f0;
                    color: #fff;
                    padding: 12px 24px;
                    text-decoration: none;
                    border-radius: 5px;
                    margin-top: 20px;
                    font-size: 18px;
                    transition: background-color 0.3s ease-in-out;
                }
    
                .cta-button:hover {
                    background-color: #0056b3;
                }
    
                .next-steps {
                    margin-top: 30px;
                    text-align: left;
                    padding: 20px;
                    background-color: #f5f5f5;
                    border-radius: 5px;
                }
    
                .step {
                    display: flex;
                    align-items: center;
                    margin-bottom: 20px;
                }
    
                .step-icon {
                    width: 40px;
                    height: 40px;
                    margin-right: 15px;
                }
    
                .step-text {
                    font-size: 20px;
                }
            </style>
        </head>
        <body>
            <div class="container">
                <h1>Welcome to '.$GLOBALS['system_name'].'</h1>
                <p>Hello '.$validatedName.',</p>
                <p>Thank you for joining '.$GLOBALS['system_name'].'. We are thrilled to have you as a part of our platform.</p>
    
                <p>To begin your crypto investment journey, please click the button below to verify your email address:</p>
                <a href="'.$VERIFY_EMAIL_LINK.'?email='.$email.'&token='.$verify_code.'" class="cta-button">Verify Email</a>
    
                <p>If you\'re having issues clicking the button, you can copy and paste the following link into your browser\'s address bar to verify your email:</p>
                <p><a href="'.$VERIFY_EMAIL_LINK.'?email='.$email.'&token='.$verify_code.'">'.$VERIFY_EMAIL_LINK.'?email='.$email.'&token='.$verify_code.'</a></p>
    
                <p>If you have any questions or need assistance with your investments, our support team is here to help - '.$GLOBALS['system_support_email'].'.</p>
    
                <div class="next-steps">
                    <h2>Next Steps:</h2>
                    <div class="step">
                        <img src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADIAAAAyCAYAAAAeP4ixAAAACXBIWXMAAAsTAAALEwEAmpwYAAACDUlEQVR4nO3ZT4hNYRjH8Y8J6ZZI+bcw41/2spCYhbKyt7GwIZoFZWVhaUGGspWNZEPKmhnlz1jIKCuKUvKvUf4O0hRHp55btxPuuZo79z3jfOtd3ee59/d7n+d9z3vPS03NrGMV9uICHuMDnuEo5kiYBnbiDB4h+8sYkhD5rG7EEdzA94LYT7iKgxjEUuyLz+72WnwuZhfO4mVB+A+M4wR2YP5v8ldG7IuZFr4gRJ3EQ/wsiH+Oc2FuSYnvmxd5UzOg3Vrsx2V8Lgj/ipFop03/uGizGF1hPYaj5MV2eYDj2P6HdknCyAZcKrTMa5zHbiyb7h/UBSMH8K1l5q9gi4ox1DIzF6O1Ksfqlkrcxh28a/MA6+aYxFh0SL6rleZYD0VnbcY9rChrZKwl8VUs6kV6x+KoxsfQNF52d3wTCXniGumwDu9D26EyCZMRfFh67Alt98sENw93/dJjYcsJoi3N9TFXmmRlH5hdPetMA1ltJDGyuiKJkdUVSYysKhUZwCi+xN/m/qoaGS2ceK9X1chkwUj+gqOSRkZmS0UGQnxemWtVXiPtqI2kRla3VmJkdUUSI/vvKjIVgfmdX2o0OrkIehrBW6XHYGh7Uib4dATfRJ906IuX6llcOrVlOd5Gwi1s63GbNUJD08REJxdMm1vMpDQmQltH5JU5Ff3Y3AB6MaZCw3Bcf9fU1OicXxCUb8WWhAitAAAAAElFTkSuQmCC" class="step-icon" style="color: #7367f0;">
                        <p class="step-text">1. Fund your Wallet.</p>
                    </div>
                    <div class="step">
                        <img src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADIAAAAyCAYAAAAeP4ixAAAACXBIWXMAAAsTAAALEwEAmpwYAAAEZElEQVR4nO2YWaiVVRTHf06Zem9qjlg9pJJj+iBiD5oDIRSFKSJimUSZoBaiSQRipoHmgziWVhZpEQqWFoqKpGahpnnPiwMO4YgpztdySk8s+W9ZfHznTufcznfg/GHDvXuvs7+99pr+a0MRRRRRRC2hIfA2sAu4rrETmAg8RIHgMSAFpDOMfUA7CsASQYmDwBCgVONl4JDW/ki6Zd5xSjTT3FNAL/1tc0GZCSQYu3VIs4ShL1AObHUywyRjMZNYlOuQ5kqGZ+RqXpFHJHONBKE1MAsoU2YKAT0daCWZrRkUKSchGK5bzZSdLgAvxSgyIkmuZUrc04F+APoDTTQGAGu1dgf4wAV7S+Ck1qym5N2d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RJnfDdtB5ynYN1JCNjPQ865LyaB2HZ4FfKimAJ9WDFAR6qedPyTrn1aOP14NGEUVQAPgPg0KxYrKql1EAAAAASUVORK5CYII=" class="step-icon" style="color: #7367f0;">
                        <p class="step-text">2. Choose from the investment options and set up your investment.</p>
                    </div>
                    <div class="step">
                        <img src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADIAAAAyCAYAAAAeP4ixAAAACXBIWXMAAAsTAAALEwEAmpwYAAAE70lEQVR4nO2ae4hVVRTGf+Yjx7GHTBEJmZiWhRY9KFL/SHtA9pqigsKmogwzapDKREjsYQmRYDSa0YPC6J+youid04MejCVhpUXh9FCnhjJNm2m0uTdWfgcWhztz797n3jsjzAcbhnP3Wmetvfda69vrDAygV4wF1gDtQAtwCfupE21A3o0ccBf7mRNfy/iPgWOA+cC/evYCMAtYCLwObAY6gPeBI/vC4FOAJhnwucbPQLcM/gqoc/MvAHamdik9zLmqO/FPD8b8BaxIOZHgaOAeYBWwFLgKeNDJzq62I7e5l98BnA6cCowBhrh5E4AjetAxGLjP7eCfwMFUGccDXTLgO2BU6vejFB95GfosMML9fojiw+/kXPoI1ygTmRGbgDP1/DTFSl4xsVt/vypnpsl574Q5fQB9iLkpg9qccx8AhwOTVUvSsfST+3sG/QBNKQN/B5YAw9yciUAzsBdoBe4HbtD8H+gnOFBHy4yaEyD3lGQeoh9hlozaECCzXjKeulj8PAqsA34FtgIfAgt6yX5lhQVxpwwbV6LMFs23tH0W8GmRYtkFXEkV0KIXXlHi/F80/x2XIGwYZblVKd3G2cDzWqiQoxuNV2SIFctiGOriqqfRATytmkQ10vOhQCOwzRXIeaIxvgja6p6j4E4zYxvfiLY8orjYq+dWhy6tpAM14kl/p85xmrpvB3YVMHy9VnyHe2YEdKr0G915zrGD+ko4MV35Py96vho4V0dmhjLPF87InHbMVvpecbMEtmvXAt+7uU1uN2139wDXl9uJOW7bjVqcXCa9w0RAd7ojeqJ+swUqK5a6VVsMDCr3C9iXvpMas6MS9GWBlHdWIZ/XAM+4uKsvZ+XOKR5ClS6WQaFyg4DHXCpO2HU0JjgqHnODi3UkceYJyberHxAFu8V9IkVPBsqeAbyp1UwqtrHi2kA9Q90lbW1sXDZKQWvgNfQWd4X9DfjW1ZgWFdEQjAH+kPzNgbL/5/GkAp8fmHW6tBMXuucjtat5Ve9QNEjWHDooRHCeBD8LfOGdkrNOShpDREU6Q41hH9fa4BoeJWOzhKwfFYLlkrNjWQhTgJsim3EXS/cWxW9RnCSBbRGs827Jvp1qDZUDgxVz+VLT8SJNtkZaKCaKGyUkcGbq/p4Vq6TbGn1FsbbANTQEl7uVy4v9vqw6ZEGfBRdJ53ulTN6qyZMyvNAMvlEOeKreruexGCs9ltKLIrl/pzuIWc62kb8XnUOXZeBheS1OUSQ0fTjlxwpXpWMwXPIWh0WRHIXRES9qVnu0J0yT7h+Jw2jX9C6KTRli5COxZPvAUwgzpdt6VzGY7O74JXdELEOEYrZk3yhwNK2uvKXfjRXHoF7yL4XQjGWRgf2u6+s+oCr/sKMYGzOk4eXScXspk8frItWmLBGKGjUZEgrvuyzWWDiMOIxQKzUX0NHkNb3cDIpFrWtWL4yg72kskS6zrWScoHrSLQodiyw3RI/rZEuHvpgFoUHbmOvlA2elUQeslA3d+lIWhatdN3GXHJoecWUNQa2YwErXpdytr8CZMF7/juG75lb9vxQbna/dO0+1Z5xWclQqO43UszrNmSSZBv1XxOPSmTCLpF26RjaUDcfpk/I6R9UrMfbobm/vOpYKo0Z0o1H1ZrXoyUY1K7ZrJK2k5Hgkz1s1t1myy6RramTKH8AAqBD+A3ck0b2APbA0AAAAAElFTkSuQmCC" class="step-icon" style="color: #7367f0;">
                        <p class="step-text">3. Start withdrawing your profits.</p>
                    </div>
                </div>
    
                <p>Thank you for choosing '.$GLOBALS['system_name'].'. We look forward to helping you achieve your financial goals!</p>
                <p>Best regards,<br>'.$GLOBALS['system_name'].' Team</p>
            </div>
        </body>
        </html>';
    
        // Check if the user name is valid
        if ($validatedName !== false) {
            // Name is Valid
            // Check the result and perform actions
            // Validate email format
            $emailIsValid = validateEmail($email);

            if ($emailIsValid) {
                // Email is valid, proceed with your logic

                // Check if passwords match
                $passwordMatch = checkPasswordMismatch($password, $password_confirm);

                if ($passwordMatch) {
                    // Check if the email already exists in the database
                    $emailExist = checkEmailExists($email);

                    if (!$emailExist) {
                        // Email does not exist, proceed with your logic

                        // Send verification email
                        $sendVerificationEmail = sendEmail($email, $subject, $message, $GLOBALS['system_support_email'], $GLOBALS['system_name'], $GLOBALS['system_support_email']);

                        if ($sendVerificationEmail) {
                            // Register the user in the database
                            $registerUser = registerUser($validatedName, $email, $tel, $currency, $country, $password, $referralID, $verify_code, $join_date);

                            if ($registerUser) {
                                // If the user has a referrer, update the referrer for the new user
                                if (isset($ref) && !empty($ref)) {
                                    $updateReferrerForNewUser = updateReferrerForNewUser($referralID, $ref);

                                    if (!$updateReferrerForNewUser) {
                                        die('Failed to update referrer for new user');
                                    }
                                }
                                echo 'success';
                            } else {
                                die('Failed to register user');
                            }
                        } else {
                            die('Failed to send verification email');
                        }
                    } else {
                        die('Email address already exists');
                    }
                } else {
                    die('Passwords do not match');
                }
            } else {
                die('Invalid email');
            }
        } else {
            die('Invalid name input');
        }
    }
Leave a Comment