Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- use PHPMailer\PHPMailer\PHPMailer;
- use PHPMailer\PHPMailer\Exception;
- require '/var/www/vhosts/thelancesaga.com/phpmailer/src/Exception.php';
- require '/var/www/vhosts/thelancesaga.com/phpmailer/src/PHPMailer.php';
- require '/var/www/vhosts/thelancesaga.com/phpmailer/src/SMTP.php';
- // Include the necessary PHPMailer files and other required files
- include 'includes/core.php';
- include 'menu/menu.php';
- $email = $_POST['email'];
- $email = filter_input(INPUT_POST, 'email', FILTER_SANITIZE_EMAIL);
- $email = strtolower($_POST['email']);
- $email = trim($email);
- if(filter_var($email, FILTER_VALIDATE_EMAIL, FILTER_NULL_ON_FAILURE)) {
- $stmt = $pdo->prepare("SELECT * FROM download WHERE email = :email");
- $stmt->bindParam(':email', $email);
- $stmt->execute();
- if($stmt->rowCount() > 0){
- $error = "<br><span class='error_msg'>This e-mail has already been used! Contact me if you need assistance.</span><br>";
- // Prepare the response
- $response = array('error' => $error);
- // Set the content type to JSON
- header('Content-Type: application/json');
- // Encode the response as JSON and echo it back to the client
- echo json_encode($response);
- } else {
- // send an e-mail to user, already works
- // Prepare the success response
- $response = array('success' => 'Thank you for your submission!');
- // Set the content type to JSON
- header('Content-Type: application/json');
- // Encode the response as JSON and echo it back to the client
- echo json_encode($response);
- }
- }
- ?>
- <!DOCTYPE html>
- <html lang="en">
- <head>
- <meta charset="utf-8">
- <meta http-equiv="X-UA-Compatible" content="IE=edge">
- <meta name="viewport" content="width=device-width, initial-scale=1">
- <title>The Lance Saga</title>
- <link type="text/css" href="includes/code.css" rel="stylesheet" />
- <link type="text/css" href="menu/menu.css" rel="stylesheet" />
- <link rel="shortcut icon" href="includes/favicon.ico" type="image/x-icon" />
- <style>
- /* CSS for the loading icon */
- #loading {
- display: none;
- position: absolute;
- top: 50%;
- left: 50%;
- transform: translate(-50%, -50%);
- z-index: 1000;
- }
- #loading::after {
- content: '';
- width: 40px;
- height: 40px;
- border: 4px solid #f3f3f3;
- border-top: 4px solid #3498db;
- border-radius: 50%;
- animation: spin 1s linear infinite;
- position: absolute;
- top: 0;
- bottom: 0;
- left: 0;
- right: 0;
- margin: auto;
- }
- @keyframes spin {
- 0% { transform: rotate(0deg); }
- 100% { transform: rotate(360deg); }
- }
- </style>
- <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js"></script>
- <script>
- $(document).ready(function(){
- $("#register_form").submit(function(event){
- event.preventDefault();
- $("#loading").show();
- $("body").css("background-color", "rgba(0, 0, 0, 0.5)"); // Dim the background
- $.ajax({
- type: "POST",
- url: "buy.php",
- data: $(this).serialize(),
- dataType: "json", // Set the expected data type to JSON
- success: function(response){
- if (response.error) {
- $("#error_msg").html(response.error);
- $("#loading").hide();
- $("body").css("background-color", ""); // Restore the background color
- } else {
- // Redirect to thanks.php or display a success message
- window.location.href = "thanks.php";
- }
- },
- error: function(xhr, status, error){
- // Handle AJAX error
- console.log("AJAX error: " + error);
- $("#loading").hide();
- $("body").css("background-color", ""); // Restore the background color
- }
- });
- });
- });
- </script>
- </head>
- <body>
- <center>
- <div class="parent-container">
- <div class="content">
- <img src="images/cooltext445040266371200.png"><br>
- <img src="images/warning.png"><br>
- <img src="images/cooltext450730865402644.png"><br>
- <img src="images/cooltext422040969105422.png"><br>
- <form method="post" action="buy.php" id="register_form">
- <label for="email"><img src="images/cooltext431870786470060.png"></label><br>
- <input type="email" name="email" minlength="6" size="35" maxlength="50" required autofocus oninput="this.value = this.value.replace(/</g, '<').replace(/>/g, '>')" ><br>
- <?php if (isset($error)): ?>
- <?php echo $error; ?>
- <a href="buy.php"><img src="images/cooltext333209107545846.png"></a><br>
- <?php endif ?>
- <button type="submit" name="register" id="button">Submit Now</button>
- </form>
- <div id="loading" style="display:none;"></div>
- </div>
- </div>
- </center>
- </body>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement