]> git.mxchange.org Git - mailer.git/blobdiff - doubler.php
More usage of EL
[mailer.git] / doubler.php
index 635448e77b3de39a2c0c33f814b16c056abaed69..9511fb33320ad8b7df96d633c7826cb0452332ca 100644 (file)
@@ -92,10 +92,10 @@ if (isFormSent()) {
                // Check all together
                if ((isUserDataValid()) && (getUserData('password') == generateHash(postRequestParameter('pass'), substr(getUserData('password'), 0, -40))) && (getUserData('status') == 'CONFIRMED') && ($probe_points)) {
                        // Nickname resolved to a unique userid or direct userid entered by the member
-                       $GLOBALS['doubler_userid'] = getUserData('userid');
+                       $GLOBALS['local_doubler_userid'] = getUserData('userid');
 
                        // Calulcate points
-                       $points = countSumTotalData(getUserData('userid'), 'user_points', 'points') - countSumTotalData(getUserData('userid'), 'user_data', 'used_points');
+                       $points = getTotalPoints(getUserData('userid'));
 
                        // So let's continue with probing his points amount
                        if (($points - getConfig('doubler_left') - postRequestParameter('points') * getConfig('doubler_charge') / 100) >= 0) {
@@ -117,7 +117,7 @@ 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(