Fix for removed userid
[mailer.git] / inc / mysql-manager.php
index 717865cbaaec5e2767ff6afeb1b349cff605c481..a54357dafddb326f3689d6cec0ff06e5df95cffc 100644 (file)
@@ -623,15 +623,15 @@ function IS_MEMBER()
                                //* DEBUG: */ echo __LINE__."!!!<br />";
                                destroy_user_session();
 
-                               // Remove array elements to prevent errors
-                               unset($GLOBALS['userid']);
+                               // Reset userid
+                               $GLOBALS['userid'] = 0;
                        }
                } else {
                        // Cookie data is invalid!
                        //* DEBUG: */ echo __LINE__."***<br />";
 
-                       // Remove array elements to prevent errors
-                       unset($GLOBALS['userid']);
+                       // Reset userid
+                       $GLOBALS['userid'] = 0;
                }
 
                // Free memory
@@ -641,8 +641,8 @@ function IS_MEMBER()
                //* DEBUG: */ echo __LINE__."///<br />";
                destroy_user_session();
 
-               // Remove array elements to prevent errors
-               unset($GLOBALS['userid']);
+               // Reset userid
+               $GLOBALS['userid'] = 0;
        }
 
        // Cache status
@@ -1060,8 +1060,7 @@ function REMOVE_RECEIVER(&$ARRAY, $key, $uid, $pool_id, $stats_id="", $bonus=fal
        return $ret;
 }
 //
-function GET_TOTAL_DATA($search, $tableName, $lookFor, $whereStatement="userid", $onlyRows=false)
-{
+function GET_TOTAL_DATA($search, $tableName, $lookFor, $whereStatement="userid", $onlyRows=false) {
        $ret = 0;
        if ($onlyRows) {
                // Count rows
@@ -1075,15 +1074,16 @@ function GET_TOTAL_DATA($search, $tableName, $lookFor, $whereStatement="userid",
 
        // Load row
        list($ret) = SQL_FETCHROW($result);
-       //* DEBUG: */ echo __LINE__."*".$DATA."/".$search."/".$tableName."/".$ret."*<br />\n";
+
+       // Free result
        SQL_FREERESULT($result);
-       if (empty($ret)) {
-               if (($lookFor == "counter") || ($lookFor == "id")) {
-                       $ret = 0;
-               } else {
-                       $ret = "0.00000";
-               }
-       }
+
+       // Fix empty values
+       if ((empty($ret)) && ($lookFor != "counter") && ($lookFor != "id") && ($lookFor != "userid")) {
+               $ret = "0.00000";
+       } // END - if
+
+       // Return value
        return $ret;
 }
 /**