]> git.mxchange.org Git - mailer.git/blobdiff - doubler.php
Deprecated $DATA renamed:
[mailer.git] / doubler.php
index 16aceb6e3eaf93baa3566f8987054c89159d4308..99ab704236745fcaf8d8ffaae1765a2bb6c17ad8 100644 (file)
@@ -67,7 +67,7 @@ if (isFormSent()) {
        // Begin with doubling process
        if ((isPostRequestParameterSet('userid')) && (isPostRequestParameterSet('password')) && (isPostRequestParameterSet('points'))) {
                // Probe for nickname extension and if a nickname was entered
-               if (isNickNameUsed(postRequestParameter('userid'))) {
+               if (isNicknameUsed(postRequestParameter('userid'))) {
                        // Nickname in URL, so load the id
                        fetchUserData(postRequestParameter('userid'), 'nickname');
                } else {
@@ -99,15 +99,15 @@ if (isFormSent()) {
                        if (($points - getConfig('doubler_left') - postRequestParameter('points') * getConfig('doubler_charge') / 100) >= 0) {
                                // Enough points are left so let's continue with the doubling process
                                // Create doubling "account" with *DOUBLED* points
-                               SQL_QUERY_ESC("INSERT INTO `{?_MYSQL_PREFIX?}_doubler` (`userid`, `refid`, `points`, `remote_ip`, `timemark`, `completed`, `is_ref`) VALUES (%s,%s,%s,'%s', UNIX_TIMESTAMP(), 'N','N')",
+                               SQL_QUERY_ESC("INSERT INTO `{?_MYSQL_PREFIX?}_doubler` (`userid`,`refid`,`points`,`remote_ip`,`timemark`,`completed`,`is_ref`) VALUES (%s,%s,%s,'%s', UNIX_TIMESTAMP(), 'N','N')",
                                        array(
                                                getUserData('userid'),
-                                               makeDatabaseUserId(determineReferalId()),
+                                               makeZeroToNull(determineReferalId()),
                                                bigintval(postRequestParameter('points') * 2),
                                                detectRemoteAddr()
                                        ), __FILE__, __LINE__);
 
-                               // Subtract entered points
+                               // Subtract entered points and ignore return status
                                subtractPoints('doubler', getUserData('userid'), postRequestParameter('points'));
 
                                // Add points to "total payed" including charge
@@ -118,9 +118,9 @@ if (isFormSent()) {
                                // Add second line for the referal but only when userid != refid
                                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,'%s',UNIX_TIMESTAMP(),'N','Y')",
+                                       SQL_QUERY_ESC("INSERT INTO `{?_MYSQL_PREFIX?}_doubler` (`userid`,`refid`,`points`,`remote_ip`,`timemark`,`completed`,`is_ref`) VALUES (%s,0,%s,'%s',UNIX_TIMESTAMP(),'N','Y')",
                                                array(
-                                                       makeDatabaseUserId(determineReferalId()),
+                                                       makeZeroToNull(determineReferalId()),
                                                        (postRequestParameter('points') * 2 * getConfig('doubler_ref') / 100),
                                                        detectRemoteAddr()
                                                ), __FILE__, __LINE__);
@@ -152,7 +152,7 @@ if (isFormSent()) {
                } elseif (postRequestParameter('points') > getConfig('doubler_max')) {
                        // Too much points entered
                        $content['message'] = '{--DOUBLER_FORM_POINTS_MAX--}';
-               } elseif (isNickNameUsed(postRequestParameter('userid'))) {
+               } elseif (isNicknameUsed(postRequestParameter('userid'))) {
                        // Cannot resolv nickname -> userid
                        $content['message'] = '{--DOUBLER_FORM_404_NICKNAME--}';
                } else {
@@ -172,7 +172,9 @@ if (isFormSent()) {
 } // END - if (isFormSet())
 
 // Shall I check for points immediately?
-if (getConfig('doubler_send_mode') == 'DIRECT') loadInclude('inc/mails/doubler_mails.php');
+if (getConfig('doubler_send_mode') == 'DIRECT') {
+       loadInclude('inc/mails/doubler_mails.php');
+} // END - if
 
 // Output header
 loadIncludeOnce('inc/header.php');