Guest User

Untitled

a guest
Jan 20th, 2019
214
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.24 KB | None | 0 0
  1. if (isset($_POST['openemailmem'])){
  2. $memberuser = $_POST['openemailmemusername'];
  3. $sql = "SELECT email, username, password, status FROM csvdata WHERE memberview =:user ";
  4. $getinfo=$DBH->prepare($sql);
  5. $getinfo->execute(array(':user' => $memberuser));
  6.  
  7. while ($row = $getinfo->fetch(PDO::FETCH_ASSOC)) {
  8. $check = $row;
  9. $newEmployeeEmail = $check['email'];
  10. $csvusername = $check['username'];
  11. $password = $check['password'];
  12. $status = $check['status'];
  13.  
  14. if ($status == "Open"){
  15. echo "tesing";
  16. $from = "the email of where it is coming from is here but i removed";
  17. $to = $newEmployeeEmail;
  18. if (!empty($_POST['cc'])){
  19. $cc = $_POST['cc'];
  20. }
  21. if (!empty($_POST['ccsend'])){
  22. $cc = $_POST['ccsend'];
  23. $to .= ", $cc";
  24. }
  25. $subject = "removed msg";
  26. $body = "removed msg";
  27. $host = "i removed";
  28. $username = "i removed";
  29. $password = "i removed";
  30. $headers = array ('From' => $from, 'To' => $to,'Cc' => $cc, 'Subject' => $subject);
  31. $smtp = Mail::factory('smtp', array ('host' => $host, 'auth' => true, 'username' => $username, 'password' => $password));
  32. $mail = $smtp->send($to, $headers, $body);
  33. }
  34. }
  35.  
  36. header("Location: I removed this.php?getmsg=12");
  37. exit;
  38.  
  39. }
  40.  
  41. if (isset($_POST['openemailmem']))
  42. {
  43. $memberuser = $_POST['openemailmemusername'];
  44. $sql = "SELECT email, username, password, status "
  45. . "FROM csvdata WHERE memberview =:user ";
  46. $getinfo = $DBH->prepare($sql);
  47. $getinfo->execute(array(':user' => $memberuser));
  48.  
  49. $log_file = "/home/my/transaction.log";
  50. $now = "[" . date("Ymd-His") . "] ";
  51.  
  52. $message = $now . "Starting loop...";
  53. error_log($message, 3, $log_file);
  54.  
  55. while ($row = $getinfo->fetch(PDO::FETCH_ASSOC))
  56. {
  57.  
  58. $check = $row;
  59. $newEmployeeEmail = $check['email'];
  60. $csvusername = $check['username'];
  61. $password = $check['password'];
  62. $status = $check['status'];
  63.  
  64. if ($status == "Open")
  65. {
  66. echo "tesing";
  67. $from = "the email of where it is coming from is here but i removed";
  68. $to = $newEmployeeEmail;
  69. if (!empty($_POST['cc']))
  70. {
  71. $cc = $_POST['cc'];
  72. }
  73. if (!empty($_POST['ccsend']))
  74. {
  75. $cc = $_POST['ccsend'];
  76. $to .= ", $cc";
  77. }
  78. $subject = "removed msg";
  79. $body = "removed msg";
  80. $host = "i removed";
  81. $username = "i removed";
  82. $password = "i removed";
  83. $headers = array(
  84. 'From' => $from,
  85. 'To' => $to,
  86. 'Cc' => $cc,
  87. 'Subject' => $subject,
  88. );
  89.  
  90. $now = "[" . date("Ymd-His") . "] ";
  91. $message = $now . "Before connecting to server - " . $to;
  92. error_log($message, 3, $log_file);
  93.  
  94. $smtp = Mail::factory(
  95. 'smtp',
  96. array(
  97. 'host' => $host,
  98. 'auth' => true,
  99. 'username' => $username,
  100. 'password' => $password,
  101. )
  102. );
  103.  
  104. $now = "[" . date("Ymd-His") . "] ";
  105. $message = $now . "After connecting to server - " . $to;
  106. error_log($message, 3, $log_file);
  107.  
  108. $now = "[" . date("Ymd-His") . "] ";
  109. $message = $now . "Before sending email - " . $to;
  110. error_log($message, 3, $log_file);
  111.  
  112. $mail = $smtp->send($to, $headers, $body);
  113.  
  114. $now = "[" . date("Ymd-His") . "] ";
  115. $message = $now . "After sending email - " . $to;
  116. error_log($message, 3, $log_file);
  117. }
  118. }
  119.  
  120. $now = "[" . date("Ymd-His") . "] ";
  121. $message = $now . "End of loop";
  122. error_log($message, 3, $log_file);
  123.  
  124. header("Location: I removed this.php?getmsg=12");
  125. exit;
  126.  
  127. }
Add Comment
Please, Sign In to add comment