// Load all rallyes (usally we have only one rallye active per time!
list($id, $title, $start, $end, $notify, $min_users, $min_prices) = SQL_FETCHROW($result);
// Load all rallyes (usally we have only one rallye active per time!
list($id, $title, $start, $end, $notify, $min_users, $min_prices) = SQL_FETCHROW($result);
-WHERE d.status='CONFIRMED' AND d.max_mails > 0 AND d.mails_confirmed >= %s AND p.ref_depth='1' AND p.points > 0 AND d.userid=%d",
- array($CONFIG['ref_payout'], bigintval($uid)), __FILE__, __LINE__);
+WHERE d.status='CONFIRMED' AND d.max_mails > 0 AND d.mails_confirmed >= %s AND p.ref_depth=1 AND p.points > 0 AND d.userid=%d",
+ array($_CONFIG['ref_payout'], bigintval($uid)), __FILE__, __LINE__);
// First check how many prices are set
$result = SQL_QUERY_ESC("SELECT id FROM "._MYSQL_PREFIX."_rallye_prices WHERE rallye_id=%d ORDER BY price_level",
// First check how many prices are set
$result = SQL_QUERY_ESC("SELECT id FROM "._MYSQL_PREFIX."_rallye_prices WHERE rallye_id=%d ORDER BY price_level",
$result_ref = SQL_QUERY_ESC("SELECT DISTINCT p.points FROM "._MYSQL_PREFIX."_user_points AS p
LEFT JOIN "._MYSQL_PREFIX."_user_data AS d
ON p.userid=d.userid
$result_ref = SQL_QUERY_ESC("SELECT DISTINCT p.points FROM "._MYSQL_PREFIX."_user_points AS p
LEFT JOIN "._MYSQL_PREFIX."_user_data AS d
ON p.userid=d.userid
-WHERE d.userid=%d AND d.status='CONFIRMED' AND p.ref_depth='1' AND d.max_mails > 0 AND d.mails_confirmed >= %s AND d.last_online >= %s
-LIMIT 1", array(bigintval($uid), $CONFIG['ref_payout'], $since), __FILE__, __LINE__);
+WHERE d.userid=%d AND d.status='CONFIRMED' AND p.ref_depth=1 AND d.max_mails > 0 AND d.mails_confirmed >= %s AND d.last_online >= %s
+LIMIT 1", array(bigintval($uid), $_CONFIG['ref_payout'], $since), __FILE__, __LINE__);
// Load rallye data
list($id, $title, $start, $end, $notify, $min_users, $min_prices) = SQL_FETCHROW($result);
// Load rallye data
list($id, $title, $start, $end, $notify, $min_users, $min_prices) = SQL_FETCHROW($result);
array($DATA['points'], bigintval($uid)), __FILE__, __LINE__);
// Update mediadata as well
array($DATA['points'], bigintval($uid)), __FILE__, __LINE__);
// Update mediadata as well
-WHERE d.status='CONFIRMED' AND d.max_mails > 0 AND d.mails_confirmed >= %s AND p.ref_depth='1' AND p.points > 0 AND d.userid=%d",
- array($CONFIG['ref_payout'], bigintval($uid)), __FILE__, __LINE__);
+WHERE d.status='CONFIRMED' AND d.max_mails > 0 AND d.mails_confirmed >= %s AND p.ref_depth=1 AND p.points > 0 AND d.userid=%d",
+ array($_CONFIG['ref_payout'], bigintval($uid)), __FILE__, __LINE__);
// Check for expired rallyes
$EXPIRE = time() - ONE_DAY * 3; // The hard-coded value...
$result_rallye = SQL_QUERY_ESC("SELECT id, title, start_time, end_time FROM "._MYSQL_PREFIX."_rallye_data WHERE end_time <= %s AND expired='Y'",
// Check for expired rallyes
$EXPIRE = time() - ONE_DAY * 3; // The hard-coded value...
$result_rallye = SQL_QUERY_ESC("SELECT id, title, start_time, end_time FROM "._MYSQL_PREFIX."_rallye_data WHERE end_time <= %s AND expired='Y'",