}
if (IS_FORM_SENT()) {
- $SQLs = array();
+ INIT_SQLS();
switch (REQUEST_GET('sub'))
{
case "points":
- $SQLs[] = "UPDATE `{!_MYSQL_PREFIX!}_config` SET points_register='".REQUEST_POST('points_register')."', points_ref='".REQUEST_POST('points_ref')."' WHERE config=0 LIMIT 1";
+ ADD_SQL("UPDATE `{!_MYSQL_PREFIX!}_config` SET points_register='".REQUEST_POST('points_register')."', points_ref='".REQUEST_POST('points_ref')."' WHERE config=0 LIMIT 1");
break;
case "ref":
switch (REQUEST_GET('do'))
{
case "add":
- $SQLs[] = "INSERT INTO `{!_MYSQL_PREFIX!}_refdepths` (level, percents) VALUES ('".REQUEST_POST('lvl')."','".REQUEST_POST('perc')."')";
+ ADD_SQL("INSERT INTO `{!_MYSQL_PREFIX!}_refdepths` (level, percents) VALUES ('".REQUEST_POST('lvl')."','".REQUEST_POST('perc')."')");
break;
case "edit": // Change entries
case "settings":
$REF = bigintval(REQUEST_POST('ref_payout'));
- $SQLs[] = sprintf("UPDATE `{!_MYSQL_PREFIX!}_config` SET
+ ADD_SQL(sprintf("UPDATE `{!_MYSQL_PREFIX!}_config` SET
allow_direct_pay='%s',
reg_points_mode='%s',
ref_payout='%s'
REQUEST_POST('allow_direct_pay'),
REQUEST_POST('reg_points_mode'),
$REF
- );
+ ));
if ((getConfig('ref_payout') == 0) && (REQUEST_POST('ref_payout') > 0)) {
// Update account's ref_payout for "must-confirm"
- $SQLs[] = sprintf("UPDATE `{!_MYSQL_PREFIX!}_user_data` SET ref_payout=(%s - mails_confirmed)
-WHERE mails_confirmed < %s", $REF, $REF);
+ ADD_SQL(sprintf("UPDATE `{!_MYSQL_PREFIX!}_user_data` SET ref_payout=(%s - mails_confirmed)
+WHERE mails_confirmed < %s", $REF, $REF));
} elseif ((getConfig('ref_payout') > 0) && (REQUEST_POST('ref_payout') == 0)) {
// Update account's ref_payout for "not-must-confirm"
- $SQLs[] = "UPDATE `{!_MYSQL_PREFIX!}_user_data` SET ref_payout=0 WHERE ref_payout > 0";
- $SQLs[] = "UPDATE `{!_MYSQL_PREFIX!}_user_points` SET points=points+locked_points WHERE locked_points>0";
- $SQLs[] = "UPDATE `{!_MYSQL_PREFIX!}_user_points` SET locked_points=0 WHERE locked_points>0";
+ ADD_SQL("UPDATE `{!_MYSQL_PREFIX!}_user_data` SET ref_payout=0 WHERE ref_payout > 0");
+ ADD_SQL("UPDATE `{!_MYSQL_PREFIX!}_user_points` SET points=points+locked_points WHERE locked_points>0");
+ ADD_SQL("UPDATE `{!_MYSQL_PREFIX!}_user_points` SET locked_points=0 WHERE locked_points>0");
}
break;
}
- if ((isset($SQLs)) && (is_array($SQLs)) && (!empty($SQLs[0]))) {
- if (strpos($SQLs[0], "INSERT") > -1) {
+ if ((IS_SQLS_VALID()) && (IS_SQLS_VALID())) {
+ if (strpos($GLOBALS['sqls'][0], "INSERT") > -1) {
$result = SQL_QUERY_ESC("SELECT id FROM `{!_MYSQL_PREFIX!}_refdepths` WHERE level='%s' LIMIT 1",
array(bigintval(REQUEST_POST('lvl'))), __FILE__, __LINE__);
SQL_FREERESULT($result);
} // END - if
- if (count($SQLs) > 0) {
+ if (COUNT_SQLS() > 0) {
// Run all SQL commands
- RUN_FILTER('run_sqls', array('dry_run' => false, 'sqls' => $SQLs));
+ RUN_FILTER('run_sqls', array('dry_run' => false));
// Entry saved...
$message = SETTINGS_SAVED;
}
// Remove SQL queries
- unset($SQLs);
+ UNSET_SQLS();
}
// Shall we display a message?