Example #1
0
 $start_time = date('Y-m-d G:i:s', strtotime("now"));
 $values = array(XE_JOB_STATUS => '2', XE_JOB_STARTED_TIME => $start_time);
 //status 2 = running
 $db->update("XEBURA_JOBS", $values, "WHERE XE_JOB_ID = '" . $jid . "'");
 // START URL REPLACEMENT PART 1
 //extract all a tag href= urls to an array
 $var = $msg_html;
 preg_match_all("/a[\\s]+[^>]*?href[\\s]?=[\\s\"\\']+" . "(.*?)[\"\\']+.*?>" . "([^<]+|.*?)?<\\/a>/", $var, &$matches);
 $matches = $matches[1];
 $list = array();
 $newlinks = array();
 //loop over array to insert in to redirect table and use regex to replace URLs
 foreach ($matches as $var) {
     // insert var to db and get id number
     $values = array(XE_LINK_CAMPAIGN_ID => $cid, XE_LINK_MID => $mid, XE_LINK_URL => $var, XE_LINK_ADDED => $now);
     $urlid = $db->insert("XEBURA_LINK", $values);
     $rlink = "http://s1.xebura.com/link?l=" . $urlid;
     // let's store these all in an array we can call later
     $tem[] = $rlink;
     $newlinks = $tem;
 }
 // END URL REPLACEMENT PART 1
 //need to modify now to handle pulling addresses from the groups
 // First we got the comma separated values from XE_CAMPAIGN_LIST_ID in the top query
 // Now we'll construct a sql query that includes the list
 $sql = "SELECT \r\nXE_ADDRESS_ID,\r\nXE_ADDRESS_EMAIL,\r\nXE_ADDRESS_FNAME,\r\nXE_ADDRESS_LNAME\r\nFROM XEBURA_MASTER_LIST\r\nWHERE XE_ADDRESS_MID = '" . $mid . "'\r\nAND XE_ADDRESS_GROUP_ID IN(" . $gid . ")\r\nAND XE_ADDRESS_OPT_STATUS IN(0,1)";
 $send_count = 0;
 $db->query($sql);
 $result = $db->query($sql);
 $total_items = $db->getNumRows($result);
 if ($db->getNumRows($result) > 0) {
Example #2
0
//               www.xebura.com
//               hello@xebura.com
//============================================================+
// This script unsubscribes ppl....
// it needs a UI
require 'class/dbclass.php';
include_once 'include/config.php';
require 'include/ses.php';
date_default_timezone_set('America/Los_Angeles');
$db = new mysqldb();
$now = date('Y-m-d G:i:s', strtotime("now"));
$ip = $_SERVER['REMOTE_ADDR'];
$eid = $_REQUEST['i'];
$cid = $_REQUEST['s'];
$mid = $db->select_single_value("XEBURA_CAMPAIGN", "XE_CAMPAIGN_MID", "WHERE XE_CAMPAIGN_ID = '" . $cid . "'");
// before we try to unsub the email id, let's check if it is already unsubscribed
$sql = "SELECT * FROM XEBURA_MASTER_LIST WHERE XE_ADDRESS_ID = '" . $eid . "' AND XE_ADDRESS_OPT_STATUS = '2'";
$db->query($sql);
$result = $db->query($sql);
if ($db->getNumRows($result) > 0) {
    echo "You are already unsubscribed from this list. If you're still receiving emails from this sender, please contact our consumer relations team at abuse@xebura.com";
} else {
    // unsubscribe the email address from the master list
    $values = array(XE_ADDRESS_OPT_STATUS => '2');
    $db->update("XEBURA_MASTER_LIST", $values, "WHERE XE_ADDRESS_ID = '" . $eid . "'");
    //echo "Step 1 - Unsubscribe from Master List - DONE  |";
    // log the event to the statistics table
    $values = array(XE_STAT_CAMPAIGN_ID => $cid, XE_STAT_MID => $mid, XE_STAT_EMAIL_ID => $eid, XE_STAT_TYPE => '4', XE_STAT_IP => $ip, XE_STAT_TIMESTAMP => $now);
    $stat = $db->insert("XEBURA_STATISTICS", $values);
    echo "You have been unsubscribed from this list successfully and will no longer receive email from this sender.";
}