]> git.mxchange.org Git - mailer.git/blobdiff - doubler.php
More rewrites to make use of (cached) wrapper functions
[mailer.git] / doubler.php
index f8acd23ae928e9d163cb4c2452e1b912e34b9cd5..8685143cf2f2f935ab93a199e9f15c76424c3fe9 100644 (file)
@@ -102,7 +102,11 @@ if (isFormSent()) {
                                // Enough points are left so let's continue with the doubling process
                                // Create doubling "account" width *DOUBLED* points
                                SQL_QUERY_ESC("INSERT INTO `{?_MYSQL_PREFIX?}_doubler` (`userid`, `refid`, `points`, `remote_ip`, `timemark`, `completed`, `is_ref`) VALUES ('%s','%s','%s','".detectRemoteAddr()."', UNIX_TIMESTAMP(), 'N','N')",
-                                       array(getUserData('userid'), determineReferalId(), bigintval(postRequestParameter('points') * 2)), __FILE__, __LINE__);
+                                       array(
+                                               getUserData('userid'),
+                                               makeDatabaseUserId(determineReferalId()),
+                                               bigintval(postRequestParameter('points') * 2)
+                                       ), __FILE__, __LINE__);
 
                                // Subtract entered points
                                subtractPoints('doubler', getUserData('userid'), postRequestParameter('points'));
@@ -113,11 +117,11 @@ if (isFormSent()) {
                                incrementConfigEntry('doubler_points', $points);
 
                                // Add second line for the referal but only when userid != refid
-                               if ((determineReferalId() > 0) && (determineReferalId() != getUserData('userid'))) {
+                               if ((isValidUserId(determineReferalId())) && (determineReferalId() != getUserData('userid'))) {
                                        // Okay add a refid line and apply refid percents
                                        SQL_QUERY_ESC("INSERT INTO `{?_MYSQL_PREFIX?}_doubler` (`userid`, `refid`, `points`, `remote_ip`, `timemark`, `completed`, `is_ref`) VALUES ('%s',0,'%s','".detectRemoteAddr()."',UNIX_TIMESTAMP(),'N','Y')",
                                                array(
-                                                       determineReferalId(),
+                                                       makeDatabaseUserId(determineReferalId()),
                                                        bigintval(postRequestParameter('points') * 2 * getConfig('doubler_ref') / 100)
                                                ), __FILE__, __LINE__);