Advertisement
zoldos

Untitled

Jan 19th, 2024
56
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 5.20 KB | Source Code | 0 0
  1. <?php
  2.  
  3. use PHPMailer\PHPMailer\PHPMailer;
  4. use PHPMailer\PHPMailer\Exception;
  5.  
  6. require '/var/www/vhosts/thelancesaga.com/phpmailer/src/Exception.php';
  7. require '/var/www/vhosts/thelancesaga.com/phpmailer/src/PHPMailer.php';
  8. require '/var/www/vhosts/thelancesaga.com/phpmailer/src/SMTP.php';
  9.  
  10. // Include the necessary PHPMailer files and other required files
  11.  
  12. include 'includes/core.php';
  13. include 'menu/menu.php';
  14.  
  15. $email = $_POST['email'];
  16. $email = filter_input(INPUT_POST, 'email', FILTER_SANITIZE_EMAIL);
  17.  
  18. $email = strtolower($_POST['email']);
  19. $email = trim($email);
  20.  
  21. if(filter_var($email, FILTER_VALIDATE_EMAIL, FILTER_NULL_ON_FAILURE)) {
  22. $stmt = $pdo->prepare("SELECT * FROM download WHERE email = :email");
  23. $stmt->bindParam(':email', $email);
  24. $stmt->execute();
  25.  
  26. if($stmt->rowCount() > 0){
  27. $error = "<br><span class='error_msg'>This e-mail has already been used! Contact me if you need assistance.</span><br>";
  28. // Prepare the response
  29. $response = array('error' => $error);
  30.  
  31. // Set the content type to JSON
  32. header('Content-Type: application/json');
  33.  
  34. // Encode the response as JSON and echo it back to the client
  35. echo json_encode($response);
  36. } else {
  37.  
  38. // send an e-mail to user, already works
  39.  
  40. // Prepare the success response
  41. $response = array('success' => 'Thank you for your submission!');
  42.  
  43. // Set the content type to JSON
  44. header('Content-Type: application/json');
  45.  
  46. // Encode the response as JSON and echo it back to the client
  47. echo json_encode($response);
  48. }
  49. }
  50. ?>
  51. <!DOCTYPE html>
  52. <html lang="en">
  53. <head>
  54. <meta charset="utf-8">
  55. <meta http-equiv="X-UA-Compatible" content="IE=edge">
  56. <meta name="viewport" content="width=device-width, initial-scale=1">
  57. <title>The Lance Saga</title>
  58. <link type="text/css" href="includes/code.css" rel="stylesheet" />
  59. <link type="text/css" href="menu/menu.css" rel="stylesheet" />
  60. <link rel="shortcut icon" href="includes/favicon.ico" type="image/x-icon" />
  61. <style>
  62. /* CSS for the loading icon */
  63. #loading {
  64. display: none;
  65. position: absolute;
  66. top: 50%;
  67. left: 50%;
  68. transform: translate(-50%, -50%);
  69. z-index: 1000;
  70. }
  71.  
  72. #loading::after {
  73. content: '';
  74. width: 40px;
  75. height: 40px;
  76. border: 4px solid #f3f3f3;
  77. border-top: 4px solid #3498db;
  78. border-radius: 50%;
  79. animation: spin 1s linear infinite;
  80. position: absolute;
  81. top: 0;
  82. bottom: 0;
  83. left: 0;
  84. right: 0;
  85. margin: auto;
  86. }
  87.  
  88. @keyframes spin {
  89. 0% { transform: rotate(0deg); }
  90. 100% { transform: rotate(360deg); }
  91. }
  92. </style>
  93. <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js"></script>
  94. <script>
  95. $(document).ready(function(){
  96. $("#register_form").submit(function(event){
  97. event.preventDefault();
  98. $("#loading").show();
  99. $("body").css("background-color", "rgba(0, 0, 0, 0.5)"); // Dim the background
  100. $.ajax({
  101. type: "POST",
  102. url: "buy.php",
  103. data: $(this).serialize(),
  104. dataType: "json", // Set the expected data type to JSON
  105. success: function(response){
  106. if (response.error) {
  107. $("#error_msg").html(response.error);
  108. $("#loading").hide();
  109. $("body").css("background-color", ""); // Restore the background color
  110. } else {
  111. // Redirect to thanks.php or display a success message
  112. window.location.href = "thanks.php";
  113. }
  114. },
  115. error: function(xhr, status, error){
  116. // Handle AJAX error
  117. console.log("AJAX error: " + error);
  118. $("#loading").hide();
  119. $("body").css("background-color", ""); // Restore the background color
  120. }
  121. });
  122. });
  123. });
  124. </script>
  125. </head>
  126. <body>
  127. <center>
  128. <div class="parent-container">
  129. <div class="content">
  130. <img src="images/cooltext445040266371200.png"><br>
  131. <img src="images/warning.png"><br>
  132. <img src="images/cooltext450730865402644.png"><br>
  133. <img src="images/cooltext422040969105422.png"><br>
  134. <form method="post" action="buy.php" id="register_form">
  135. <label for="email"><img src="images/cooltext431870786470060.png"></label><br>
  136. <input type="email" name="email" minlength="6" size="35" maxlength="50" required autofocus oninput="this.value = this.value.replace(/</g, '&lt;').replace(/>/g, '&gt;')" ><br>
  137. <?php if (isset($error)): ?>
  138. <?php echo $error; ?>
  139. <a href="buy.php"><img src="images/cooltext333209107545846.png"></a><br>
  140. <?php endif ?>
  141. <button type="submit" name="register" id="button">Submit Now</button>
  142. </form>
  143. <div id="loading" style="display:none;"></div>
  144. </div>
  145. </div>
  146. </center>
  147. </body>
  148. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement