PageRenderTime 54ms CodeModel.GetById 28ms RepoModel.GetById 0ms app.codeStats 0ms

/report/updateentry_with_update_email.php

https://bitbucket.org/3tierlogic/3tl.tabbuilder
PHP | 72 lines | 56 code | 9 blank | 7 comment | 20 complexity | 0b925926579a1b9bef8b22c9ac26729a MD5 | raw file
  1. <?
  2. $comment = addslashes($_REQUEST['c']);
  3. $id = $_REQUEST['id'];
  4. $cid = $_REQUEST['cid'];
  5. $coid = $_REQUEST['coid'];
  6. $status = $_REQUEST['s'];
  7. $notifyuser = $_REQUEST['n'];
  8. $localdb = $_REQUEST['ldb'];
  9. $activityID = $_REQUEST['aid'];
  10. if (isset($_REQUEST['l'])) {
  11. $lang = $_REQUEST['l'];
  12. } else {
  13. $lang = "en";
  14. }
  15. require("postmark.php");
  16. //*** Connect to database
  17. if ($localdb == "0") {
  18. require_once("db.php"); //*** By default Connect to the default DB in 3TL servers
  19. } else {
  20. require_once("db_".$activityID.".php"); //*** Connect to the associate campaign DB
  21. }
  22. $con = mysql_connect($dbhost_custom, $dbuser_custom, $dbpasswd_custom); // connect to database
  23. if (!$con) { // error checking and handling
  24. die('Could not connect: ' . mysql_error());
  25. }
  26. mysql_select_db($dbname_custom);
  27. $sql = "UPDATE eim_tb_ugc_".$coid." SET ep_approveState = '".$status."', ep_admincomments = '".$comment."', ep_approveTime = now() where ep_id = '".$id."' AND ep_activityID='".$activityID."'";
  28. mysql_query($sql);
  29. $sql_query = "SELECT cs_emailAddress FROM eim_tb_customer_".$coid." WHERE cs_customerID='".$cid."'";
  30. $res_query = mysql_query($sql_query);
  31. list($emailAddress) = mysql_fetch_array($res_query);
  32. if (($status == "1") && ($notifyuser == "1")) {
  33. /*$message = "<p>Great news! Your submission to the Monster Ultimate Intern Search is approved. Share your video entry with your friends using this <a href='".$entryLink."' target='_blank'>link</a> and ask them to vote for you. Good luck!</p>";
  34. $postmark = new Postmark("ef016d8a-9c74-4c1e-b264-988853dccc1b","support@3tierlogic.com");
  35. $postmark->to($emailAddress)->subject("Congrats! You're an approved Monster Ultimate Intern Searchant!")->html_message($message)->send();*/
  36. $notificationfile = "submissionnotification/notification".$activityID.$lang.".xml";
  37. if( ! $xml = simplexml_load_file($notificationfile) ) {
  38. echo "Err: could not pull out campaign info for cid: ".$activityID."<br/>";
  39. } else {
  40. $email_from = (string)$xml->campaignNotificationEmailFrom;
  41. $email_subject = (string)$xml->campaignNotificationEmailSubjectAccept;
  42. $email_body = (string)$xml->campaignNotificationEmailBodyAccept;
  43. $postmark = new Postmark("ef016d8a-9c74-4c1e-b264-988853dccc1b",$email_from);
  44. $postmark->to($emailAddress)->subject($email_subject)->html_message($email_body)->send();
  45. }
  46. }
  47. if (($status == "2") && ($notifyuser == "1")) {
  48. /*$message = "<p>Great news! Your submission to the Monster Ultimate Intern Search is approved. Share your video entry with your friends using this <a href='".$entryLink."' target='_blank'>link</a> and ask them to vote for you. Good luck!</p>";
  49. $postmark = new Postmark("ef016d8a-9c74-4c1e-b264-988853dccc1b","support@3tierlogic.com");
  50. $postmark->to($emailAddress)->subject("Congrats! You're an approved Monster Ultimate Intern Searchant!")->html_message($message)->send();*/
  51. $notificationfile = "submissionnotification/notification".$activityID.$lang.".xml";
  52. if( ! $xml = simplexml_load_file($notificationfile) ) {
  53. echo "Err: could not pull out campaign info for cid: ".$activityID."<br/>";
  54. } else {
  55. $email_from = (string)$xml->campaignNotificationEmailFrom;
  56. $email_subject = (string)$xml->campaignNotificationEmailSubjectReject;
  57. $email_body = (string)$xml->campaignNotificationEmailBodyReject;
  58. $postmark = new Postmark("ef016d8a-9c74-4c1e-b264-988853dccc1b",$email_from);
  59. $postmark->to($emailAddress)->subject($email_subject)->html_message($email_body)->send();
  60. }
  61. }
  62. echo $comment.":".$id.":".$status.":".$notifyuser.":".$cid.":".$emailAddress;
  63. ?>