]> git.mxchange.org Git - mailer.git/commitdiff
New function makeDatabaseUserId() introduced which actually converts a zero userid...
authorRoland Häder <roland@mxchange.org>
Wed, 30 Jun 2010 22:35:56 +0000 (22:35 +0000)
committerRoland Häder <roland@mxchange.org>
Wed, 30 Jun 2010 22:35:56 +0000 (22:35 +0000)
doubler.php
inc/functions.php
inc/libs/online_functions.php

index f8acd23ae928e9d163cb4c2452e1b912e34b9cd5..635448e77b3de39a2c0c33f814b16c056abaed69 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'));
@@ -117,7 +121,7 @@ if (isFormSent()) {
                                        // 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__);
 
index e1b5a9ca363ad074e1419e570afa344346c42bbf..6327c0d6e3f1aec5b271ef969bf69ec4c521a9a9 100644 (file)
@@ -2367,6 +2367,21 @@ function handleFieldWithBraces ($field) {
        return $field;
 }
 
+// Converts a userid so it can be used in SQL queries
+function makeDatabaseUserId ($userid) {
+       // Is it a valid username?
+       if (isValidUserId($userid)) {
+               // Always secure it
+               $userid = bigintval($userid);
+       } else {
+               // Is not valid or zero
+               $userid = 'NULL';
+       }
+
+       // Return it
+       return $userid;
+}
+
 //////////////////////////////////////////////////
 // AUTOMATICALLY RE-GENERATED MISSING FUNCTIONS //
 //////////////////////////////////////////////////
index 479976c181162b71e906188e3a4b749abd11c015..14c8503b624deafad86e08036c9207a9415197c0 100644 (file)
@@ -97,7 +97,7 @@ LIMIT 1",
                        getAction(),
                        getWhat(),
                        $userid,
-                       determineReferalId(),
+                       makeDatabaseUserId(determineReferalId()),
                        $isMember,
                        $isAdmin,
                        detectRemoteAddr(),
@@ -111,7 +111,7 @@ LIMIT 1",
                                getAction(),
                                getWhat(),
                                $userid,
-                               determineReferalId(),
+                               makeDatabaseUserId(determineReferalId()),
                                $isMember,
                                $isAdmin,
                                session_id(),