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);
}
// 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,
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