/report/updateentry_with_update_email.php
PHP | 72 lines | 56 code | 9 blank | 7 comment | 20 complexity | 0b925926579a1b9bef8b22c9ac26729a MD5 | raw file
- <?
- $comment = addslashes($_REQUEST['c']);
- $id = $_REQUEST['id'];
- $cid = $_REQUEST['cid'];
- $coid = $_REQUEST['coid'];
- $status = $_REQUEST['s'];
- $notifyuser = $_REQUEST['n'];
- $localdb = $_REQUEST['ldb'];
- $activityID = $_REQUEST['aid'];
- if (isset($_REQUEST['l'])) {
- $lang = $_REQUEST['l'];
- } else {
- $lang = "en";
- }
- require("postmark.php");
- //*** Connect to database
- if ($localdb == "0") {
- require_once("db.php"); //*** By default Connect to the default DB in 3TL servers
- } else {
- require_once("db_".$activityID.".php"); //*** Connect to the associate campaign DB
- }
- $con = mysql_connect($dbhost_custom, $dbuser_custom, $dbpasswd_custom); // connect to database
- if (!$con) { // error checking and handling
- die('Could not connect: ' . mysql_error());
- }
- mysql_select_db($dbname_custom);
- $sql = "UPDATE eim_tb_ugc_".$coid." SET ep_approveState = '".$status."', ep_admincomments = '".$comment."', ep_approveTime = now() where ep_id = '".$id."' AND ep_activityID='".$activityID."'";
- mysql_query($sql);
- $sql_query = "SELECT cs_emailAddress FROM eim_tb_customer_".$coid." WHERE cs_customerID='".$cid."'";
- $res_query = mysql_query($sql_query);
- list($emailAddress) = mysql_fetch_array($res_query);
- if (($status == "1") && ($notifyuser == "1")) {
- /*$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>";
- $postmark = new Postmark("ef016d8a-9c74-4c1e-b264-988853dccc1b","support@3tierlogic.com");
- $postmark->to($emailAddress)->subject("Congrats! You're an approved Monster Ultimate Intern Searchant!")->html_message($message)->send();*/
- $notificationfile = "submissionnotification/notification".$activityID.$lang.".xml";
- if( ! $xml = simplexml_load_file($notificationfile) ) {
- echo "Err: could not pull out campaign info for cid: ".$activityID."<br/>";
- } else {
- $email_from = (string)$xml->campaignNotificationEmailFrom;
- $email_subject = (string)$xml->campaignNotificationEmailSubjectAccept;
- $email_body = (string)$xml->campaignNotificationEmailBodyAccept;
-
- $postmark = new Postmark("ef016d8a-9c74-4c1e-b264-988853dccc1b",$email_from);
- $postmark->to($emailAddress)->subject($email_subject)->html_message($email_body)->send();
- }
- }
- if (($status == "2") && ($notifyuser == "1")) {
- /*$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>";
- $postmark = new Postmark("ef016d8a-9c74-4c1e-b264-988853dccc1b","support@3tierlogic.com");
- $postmark->to($emailAddress)->subject("Congrats! You're an approved Monster Ultimate Intern Searchant!")->html_message($message)->send();*/
- $notificationfile = "submissionnotification/notification".$activityID.$lang.".xml";
- if( ! $xml = simplexml_load_file($notificationfile) ) {
- echo "Err: could not pull out campaign info for cid: ".$activityID."<br/>";
- } else {
- $email_from = (string)$xml->campaignNotificationEmailFrom;
- $email_subject = (string)$xml->campaignNotificationEmailSubjectReject;
- $email_body = (string)$xml->campaignNotificationEmailBodyReject;
-
- $postmark = new Postmark("ef016d8a-9c74-4c1e-b264-988853dccc1b",$email_from);
- $postmark->to($emailAddress)->subject($email_subject)->html_message($email_body)->send();
- }
- }
-
- echo $comment.":".$id.":".$status.":".$notifyuser.":".$cid.":".$emailAddress;
- ?>