Advertisement
Guest User

Untitled

a guest
Mar 10th, 2018
365
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.13 KB | None | 0 0
  1. <?php
  2.  
  3. $servername = "localhost";
  4. $username = "lexitygf_ipn";
  5. $password = "pass";
  6. $dbname = "lexitygf_godalts";
  7.  
  8. $conn = new mysqli($servername, $username, $password, $dbname);
  9.  
  10. if ($conn->connect_error) {
  11. die("Connection failed: " . $conn->connect_error); }
  12.  
  13. use PHPMailer\PHPMailer\PHPMailer;
  14. require "PHPMailer/PHPMailer.php";
  15. require "PHPMailer/Exception.php";
  16.  
  17. if ($_SERVER['REQUEST_METHOD'] != 'POST') {
  18. header('Location: index.php');
  19. exit();
  20. }
  21.  
  22. $ch = curl_init();
  23. curl_setopt($ch, CURLOPT_URL, 'https://ipnpb.sandbox.paypal.com/cgi-bin/webscr');
  24. curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
  25. curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0);
  26. curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
  27. curl_setopt($ch, CURLOPT_POST, 1);
  28. curl_setopt($ch, CURLOPT_POSTFIELDS, "cmd=_notify-validate&" . http_build_query($_POST));
  29. $response = curl_exec($ch);
  30. curl_close($ch);
  31.  
  32. if ($response == "VERIFIED" && $_POST['receiver_email'] == "paypalmmv@gmail.com") {
  33. $cEmail = $_POST['payer_email'];
  34. $name = $_POST['first_name'] . " " . $_POST['last_name'];
  35.  
  36. $price = $_POST['mc_gross'];
  37. $currency = $_POST['mc_currency'];
  38. $item = $_POST['item_number'];
  39. $paymentStatus = $_POST['payment_status'];
  40.  
  41.  
  42. if ($item == "NFA" && $currency == "USD" && $paymentStatus == "Completed" && $price == 1.5) {
  43.  
  44. $mail = new PHPMailer();
  45. $mail->isSMTP();
  46. $mail->SMTPDebug = 0;
  47. $mail->Host = 'server209.web-hosting.com:465';
  48. $mail->SMTPAuth = true;
  49. $mail->Username = "admin@godalts.me";
  50. $mail->Password = "pass";
  51. $mail->SMTPSecure = 'tls';
  52. $mail->setFrom("admin@godalts.me", "GodAlts - 150x NFA Purchase");
  53. $mail->addAddress($cEmail, $name);
  54. $mail->isHTML(true);
  55. $mail->Subject = "Purchase Details";
  56. $mail->Body = "
  57. <center>Hi, <br><br>
  58. <center>Thank you for your purchase of 100x NFA alts at GodAlts.<br><br>
  59.  
  60. <center>Purchased Alts: <br>";
  61.  
  62. $mysqli->query("SELECT * FROM `NFA` LIMIT 0, 4");
  63.  
  64. $mail->send();
  65.  
  66. if(!$mail->Send()) {
  67. echo 'Message could not be sent.';
  68. echo 'Mailer Error: ' . $mail->ErrorInfo;
  69. }
  70. }
  71. }
  72. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement