/** ADD ENTRY */ case 'add': echo '<div class="title"> <h2>' . $LANG['banned_add_title'] . '</h2> <div style="float:right; margin: 0 2px 0 0;"> <a href="?route=banned.php&action=list" class="btn">' . $LANG['banned_view'] . '</a> </div>'; if (!empty($LANG['banned_add_subtitle'])) { echo '<span>' . $LANG['banned_add_subtitle'] . '</span>'; } echo '</div>'; if ($_SERVER['REQUEST_METHOD'] == 'POST' && isset($_POST['csrf']) && check_csrf($_POST['csrf'], 'banned_csrf')) { if (isset($_POST['ip']) && valid_ip($_POST['ip'])) { if (actions::add_banned(array('ipaddr' => $_POST['ip'], 'registration' => isset($_POST['register']) ? 1 : 0, 'login' => isset($_POST['login']) ? 1 : 0, 'site' => isset($_POST['shn-site']) ? 1 : 0, 'redirect' => isset($_POST['redirect']) ? $_POST['redirect'] : '', 'expiration' => !isset($_POST['shn-expiration']) ? 1 : 0, 'expiration_date' => !isset($_POST['shn-expiration']) && isset($_POST['expiration']) ? $_POST['expiration']['date'] . ', ' . $_POST['expiration']['hour'] : ''))) { echo '<div class="a-success">' . $LANG['msg_added'] . '</div>'; } else { echo '<div class="a-error">' . $LANG['msg_error'] . '</div>'; } } } $csrf = $_SESSION['banned_csrf'] = \site\utils::str_random(10); echo '<div class="form-table"> <form action="#" method="POST" autocomplete="off"> <div class="row"><span>' . $LANG['form_ip'] . ':</span><div><input type="text" name="ip" value="' . ($_SERVER['REQUEST_METHOD'] == 'GET' && !empty($_GET['ip']) ? htmlspecialchars($_GET['ip']) : '') . '" required /></div></div> <div class="row"><span>' . $LANG['bann_form_block'] . ':</span><div> <input type="checkbox" name="register" id="register" checked /> <label for="register">' . $LANG['bann_registrations'] . '</label> <br /> <input type="checkbox" name="login" id="login" checked /> <label for="login">' . $LANG['bann_login'] . '</label> <br />