Beispiel #1
0
 if (!$doc->load($url)) {
     $mailinfo = __phpmail("*****@*****.**", "HORNM STATS GETTING ERROR, REPORT WITH DATE: " . date('Y-m-d H:i:s'), "<b>FROM WEB02</b><br/><b>--ERROR REPORT</b><br/>");
     exit(sprintf("Failed to read stats data.(%s)\n", $mailinfo));
 }
 $items = $doc->getElementsByTagName("item");
 $doc = null;
 $uniques = 0;
 $chargebacks = 0;
 $signups = 0;
 $sales = 0;
 foreach ($items as $item) {
     $uniques += getValueByName($item->childNodes, "visits");
     $chargebacks += getValueByName($item->childNodes, "refunds");
     //actually not useful any more
     $signups += getValueByName($item->childNodes, "signups");
     $sales += getValueByName($item->childNodes, "sales");
 }
 //echo $row['agentid'] . "|" . $row['campaignid'] .  ":$uniques, $chargebacks, $signups, $sales.\n";
 //continue;
 /*
  * find out if there is any data in trans_stats where trxtime equals to $date,
  * if there are, remove them.
  * If all the stats data are "0", then ignore them.
  * */
 $conditions = sprintf(' where convert(trxtime, date) = "%s" and siteid = %d and agentid = %d and typeid = %d', $date, $siteid, $row['agentid'], $typeids[0]);
 $sql = 'select * from trans_stats' . $conditions;
 $results = mysql_query($sql, $zconn->dblink) or die("Something wrong with: " . mysql_error());
 if (mysql_num_rows($results) > 1) {
     exit("It should not be more than 1 rows of stats data for an agent in a day.\n");
 }
 $frauds = 0;
Beispiel #2
0
 $campaignid = $campaign->getAttribute("id");
 /*see if agent exists whitch matches the campaign id*/
 $sql = sprintf('select agentid from agent_site_mappings' . ' where campaignid = "%s"', $campaignid);
 $rs = mysql_query($sql, $zconn->dblink) or die("Something wrong with: " . mysql_error());
 if (mysql_num_rows($rs) == 0) {
     continue;
 }
 if (mysql_num_rows($rs) == 1) {
     $row = mysql_fetch_assoc($rs);
     $agentid = $row['agentid'];
     $items = $campaign->getElementsByTagName("item");
     $item0 = getItemByType($items, "Uniques");
     $item1 = getItemByType($items, "Signups");
     $item2 = getItemByType($items, "Sales");
     $item3 = getItemByType($items, "Refunds");
     $sql = sprintf('insert into trans_stats' . ' (agentid, siteid, typeid, raws, uniques, chargebacks, signups, sales_number, trxtime)' . ' values (%d, %d, %d, 0, %d, %d, %d, %d, "%s")', $agentid, $siteid, $typeids[0], getValueByName($item0->childNodes, $type), getValueByName($item3->childNodes, $type), getValueByName($item1->childNodes, $type), getValueByName($item2->childNodes, $type), $date);
     //echo $sql . "\n";
     $rs = mysql_query($sql, $zconn->dblink) or die("Something wrong with: " . mysql_error());
     $i++;
     $j += mysql_affected_rows();
     /*
     echo "Campaign Id " . $campaignid . ":"
     	. $item0->getAttribute("type")
     	. "(" . getValueByName($item0->childNodes, "today") . "," . getValueByName($item0->childNodes, "yesterday") . ")"
     	. "/"
     	. $item1->getAttribute("type")
     	. "(" . getValueByName($item1->childNodes, "today") . "," . getValueByName($item1->childNodes, "yesterday") . ")"
     	. "/"
     	. $item2->getAttribute("type")
     	. "(" . getValueByName($item2->childNodes, "today") . "," . getValueByName($item2->childNodes, "yesterday") . ")"
     	. "/"