]> git.mxchange.org Git - mailer.git/blobdiff - inc/doubler_send.php
query masking rewritten in more SQLs, several cleanups and fix on beg link
[mailer.git] / inc / doubler_send.php
index 374a8b19e4cc50097ddfe0f10991d6b8cad3a39d..a6ee2d0a49d8679894a50ba10d74cade267933a0 100644 (file)
@@ -73,11 +73,11 @@ WHERE u.status='CONFIRMED' AND d.points <= %s AND d.points >= %s AND d.completed
 ORDER BY d.timemark
 LIMIT %s", array($DOUBLER_POINTS, $min, $CONFIG['doubler_max_sent']), __FILE__, __LINE__);
 
-if (((SQL_NUMROWS($result_total) > 0) && ($CONFIG['doubler_sent_all'] == "Y")) || ((SQL_NUMROWS($result_main) == $CONFIG['doubler_group_sent']) && ($CONFIG['doubler_sent_all'] == "N")))
+if (((SQL_NUMROWS($result_total) > 0) && ($CONFIG['doubler_sent_all'] == 'Y')) || ((SQL_NUMROWS($result_main) == $CONFIG['doubler_group_sent']) && ($CONFIG['doubler_sent_all'] == 'N')))
 {
        // Switch to matching SQL resource
        $result_load = $result_main;
-       if ((SQL_NUMROWS($result_total) > 0) && ($CONFIG['doubler_sent_all'] == "Y")) $result_load = $result_total;
+       if ((SQL_NUMROWS($result_total) > 0) && ($CONFIG['doubler_sent_all'] == 'Y')) $result_load = $result_total;
 
        // At least one account was found
        while(list($id, $uid, $points, $ip, $time) = SQL_FETCHROW($result_load))
@@ -112,7 +112,7 @@ if (((SQL_NUMROWS($result_total) > 0) && ($CONFIG['doubler_sent_all'] == "Y")) |
                        if ($uid != $CONFIG['doubler_uid'])
                        {
                                // Add points
-                               $result = SQL_QUERY_ESC("UPDATE "._MYSQL_PREFIX."_user_points SET points=points+%s WHERE userid=%d AND ref_depth='0' LIMIT 1",
+                               $result = SQL_QUERY_ESC("UPDATE "._MYSQL_PREFIX."_user_points SET points=points+%s WHERE userid=%d AND ref_depth=0 LIMIT 1",
                                 array($points, bigintval($uid)), __FILE__, __LINE__);
 
                                // Update mediadata as well
@@ -129,12 +129,11 @@ if (((SQL_NUMROWS($result_total) > 0) && ($CONFIG['doubler_sent_all'] == "Y")) |
 
                        $OK = false;
                        // Check for jackpot inclusion in doubling process
-                       if (($jackpot > 0) && ($jackpot >= $points) && ($CONFIG['doubler_jackpot'] == "Y"))
+                       if (($jackpot > 0) && ($jackpot >= $points) && ($CONFIG['doubler_jackpot'] == 'Y'))
                        {
                                // Subtract points from jackpot
-                               $result = SQL_QUERY_ESC("UPDATE "._MYSQL_PREFIX."_jackpot SET points=points-%s WHERE ok='ok' LIMIT 1",
-                                array($points), __FILE__, __LINE__);
-                               $jackpot -= $jackpot;
+                               SUB_JACKPOT($points);
+                               $jackpot -= $points;
 
                                // Okay, done!
                                $OK = true;