More fixes for rallye
authorRoland Häder <roland@mxchange.org>
Sat, 4 Oct 2008 11:57:52 +0000 (11:57 +0000)
committerRoland Häder <roland@mxchange.org>
Sat, 4 Oct 2008 11:57:52 +0000 (11:57 +0000)
inc/databases.php
inc/modules/admin/what-list_rallyes.php
inc/mysql-manager.php

index eacf64a..a8a6a86 100644 (file)
@@ -113,7 +113,7 @@ define('USAGE_BASE', "usage");
 define('SERVER_URL', "http://www.mxchange.org");
 
 // This current patch level
-define('CURR_SVN_REVISION', "440");
+define('CURR_SVN_REVISION', "441");
 
 // Take a prime number which is long (if you know a longer one please try it out!)
 define('_PRIME', 591623);
index d4e6165..523ff1a 100644 (file)
@@ -243,7 +243,8 @@ if (isset($_POST['edit']))
                        }
 
                        // Get user points
-                       $points = GET_TOTAL_DATA($uid, "user_points", "points")  - GET_TOTAL_DATA($uid, "user_data", "used_points");
+                       $points = GET_TOTAL_DATA($uid, "user_points", "points", "userid", false, " AND ref_depth=1 LIMIT 1");
+                       //* DEBUG: */ echo basename(__FILE__).":uid={$uid},points={$points},opoints={$opoints}<br />\n";
                        $content = array(
                                'sw'      => $SW ,
                                'uid'     => $uid,
index 3ef6dee..57572a1 100644 (file)
@@ -1070,16 +1070,16 @@ 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, $add="") {
        $ret = 0;
        if ($onlyRows) {
                // Count rows
-               $result = SQL_QUERY_ESC("SELECT COUNT(%s) FROM "._MYSQL_PREFIX."_%s WHERE %s='%s'",
-                array($lookFor, $tableName, $whereStatement, $search), __FILE__, __LINE__);
+               $result = SQL_QUERY_ESC("SELECT COUNT(%s) FROM "._MYSQL_PREFIX."_%s WHERE %s='%s'%s",
+                array($lookFor, $tableName, $whereStatement, $search, $add), __FILE__, __LINE__);
        } else {
                // Add all rows
-               $result = SQL_QUERY_ESC("SELECT SUM(%s) FROM "._MYSQL_PREFIX."_%s WHERE %s='%s'",
-                array($lookFor, $tableName, $whereStatement, $search), __FILE__, __LINE__);
+               $result = SQL_QUERY_ESC("SELECT SUM(%s) FROM "._MYSQL_PREFIX."_%s WHERE %s='%s'%s",
+                array($lookFor, $tableName, $whereStatement, $search, $add), __FILE__, __LINE__);
        }
 
        // Load row