execute(" INSERT INTO `znote_accounts` (`account_id`, `ip`, `created`, `flag`) SELECT `a`.`id`, 0, ?, '' FROM `accounts` `a` LEFT JOIN `znote_accounts` `z` ON `z`.`account_id` = `a`.`id` WHERE `z`.`account_id` IS NULL; ", [time()]); $updated = db()->execute("UPDATE `znote_accounts` SET `points` = GREATEST(0, `points` + ?);", [$delta]); if ($updated !== false) { acp_log('accounts.mass_points', '', ['delta' => $delta, 'accounts' => $accountTotal]); acp_flash_success(t('acp.mpts.done', ['delta' => ($delta >= 0 ? '+' : '') . $delta, 'n' => $accountTotal])); } else { acp_flash_error(t('acp.mpts.failed')); } acp_redirect('mass_actions'); } // --------------------------------------------------- Mass premium days if (isset($_POST['premium_days'])) { $days = intv($_POST['premium_days'] ?? 0); if ($days <= 0) { acp_flash_error(t('acp.mprem.invalid_value')); acp_redirect('mass_actions'); } $updated = user_accounts_add_premdays_all($days); if ($updated !== false) { acp_log('accounts.mass_premium_days', '', ['days' => $days, 'accounts' => $accountTotal]); acp_flash_success(t('acp.mprem.done', ['days' => $days, 'n' => $accountTotal])); } else { acp_flash_error(t('acp.mprem.not_supported')); } acp_redirect('mass_actions'); } // ------------------------------------------------------------ Teleport if (isset($_POST['from'], $_POST['to'])) { $from = (string)$_POST['from']; $to = (string)$_POST['to']; $target = ''; $fail = false; if ($from === 'only') { $target = trim((string)($_POST['player_name'] ?? '')); if ($target === '' || !user_character_exist($target)) { acp_flash_error(t('acp.plr.err_invalid_teleport_char')); $fail = true; } } if (!$fail) { $set = null; if ($to === 'home') { $set = '`posx`=0, `posy`=0, `posz`=0'; } elseif ($to === 'town') { $set = '`posx`=0, `posy`=0, `posz`=0, `town_id`=' . intv($_POST['town'] ?? 0); } elseif ($to === 'xyz') { $set = '`posx`=' . intv($_POST['x'] ?? 0) . ', `posy`=' . intv($_POST['y'] ?? 0) . ', `posz`=' . intv($_POST['z'] ?? 0); } // Anything else would have produced "UPDATE players SET " and a // SQL error, so refuse instead of guessing. if ($set === null) { acp_flash_error(t('acp.plr.err_unknown_destination')); } else { if ($from === 'only') { db()->execute("UPDATE `players` SET {$set} WHERE `name` = ?;", [$target]); } else { db()->execute("UPDATE `players` SET {$set};"); } acp_log('player.teleport', $from === 'only' ? $target : 'ALL', ['destination' => $to]); acp_flash_success($from === 'only' ? t('acp.plr.tp_one_done') : t('acp.plr.tp_all_done')); } } acp_redirect('mass_actions'); } } ?>

$accountTotal]) ?>

$accountTotal]) ?>