Protection of WordPress logins
This commit is contained in:
@ -0,0 +1,56 @@
|
||||
<?php
|
||||
function updateBlockOrAllowList($postVars)
|
||||
{
|
||||
$listType = $postVars['save_kompass_balist_list_type'];
|
||||
|
||||
$saveIPList = [];
|
||||
if (isset($postVars['listElements'])) {
|
||||
foreach ($postVars['listElements'] as $curIp) {
|
||||
$curIp = trim($curIp);
|
||||
if ($curIp !== '') {
|
||||
$saveIPList[] = $curIp;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (count($postVars['new_ips']) == 1) {
|
||||
foreach (explode(PHP_EOL, $postVars['new_ips'][0]) as $newIp) {
|
||||
$newIp = trim($newIp);
|
||||
if ('' !== $newIp) {
|
||||
$saveIPList[] = $newIp;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
update_option('kompass_limit_login_' . $listType, $saveIPList);
|
||||
}
|
||||
|
||||
function kompass_print_block_allow_form($listType) {
|
||||
$elements = get_option('kompass_limit_login_' . $listType, []);
|
||||
|
||||
?>
|
||||
|
||||
<input type="hidden" name="save_kompass_balist_list_type" value="<?= $listType; ?>" />
|
||||
|
||||
<?php
|
||||
foreach ($elements as $currentIp) {
|
||||
?>
|
||||
<p>
|
||||
<input type="text" name="listElements[]" value="<?= $currentIp ?>" style="width: 350px;" /><br />
|
||||
<label style="cursor: default; color: #a0a0a0; fot-size: 9pt; font-style: italic"><?= __('Zum Löschen frei lassen', BDP_LV_PLUGIN_SLUG); ?></label>
|
||||
</p>
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
</div>
|
||||
<div class="kompass_setting_box">
|
||||
<h3><?= __('IP-Adresse hinzufügen', BDP_LV_PLUGIN_SLUG); ?></h3>
|
||||
<p>
|
||||
<textarea
|
||||
placeholder="<?= __('Please use line breaks to enter multiple ips', BDP_LV_PLUGIN_SLUG); ?>"
|
||||
name="new_ips[]"
|
||||
style="width: 350px;" rows="5"></textarea>
|
||||
</p>
|
||||
</div>
|
||||
<?php
|
||||
}
|
Reference in New Issue
Block a user