166 lines
10 KiB
PHP
166 lines
10 KiB
PHP
<table class="table checker-setting" data-toggle="table" id="checker-security" style="display:none;">
|
|
<tbody>
|
|
<tr class="has-link" style="display: none;">
|
|
<th>Rate Limiting</th>
|
|
<td>
|
|
<p class="text-muted small mb-3">Limit the number of searches per IP address to prevent abuse</p>
|
|
|
|
<div class="form-check mb-3">
|
|
<input class="form-check-input" type="checkbox" value="yes" id="security-rate-limit-enabled" name="checker[security][rate_limit][enabled]" <?= isset($checker['security']['rate_limit']['enabled']) && $checker['security']['rate_limit']['enabled'] == 'yes' ? 'checked' : '' ?>>
|
|
<label class="form-check-label fw-bold" for="security-rate-limit-enabled">
|
|
Enable Rate Limiting
|
|
</label>
|
|
</div>
|
|
|
|
<div class="rate-limit-settings" style="<?= isset($checker['security']['rate_limit']['enabled']) && $checker['security']['rate_limit']['enabled'] == 'yes' ? '' : 'display:none;' ?>">
|
|
<div class="row mb-3">
|
|
<div class="col-md-6">
|
|
<label class="form-label">Max Attempts</label>
|
|
<input type="number" name="checker[security][rate_limit][max_attempts]" value="<?= $checker['security']['rate_limit']['max_attempts'] ?? 5 ?>" class="form-control" min="1" max="100">
|
|
<small class="text-muted">Maximum searches allowed per time window</small>
|
|
</div>
|
|
<div class="col-md-6">
|
|
<label class="form-label">Time Window (minutes)</label>
|
|
<input type="number" name="checker[security][rate_limit][time_window]" value="<?= $checker['security']['rate_limit']['time_window'] ?? 15 ?>" class="form-control" min="1" max="1440">
|
|
<small class="text-muted">Reset attempts after this duration</small>
|
|
</div>
|
|
</div>
|
|
<div class="row mb-3">
|
|
<div class="col-md-6">
|
|
<label class="form-label">Block Duration (minutes)</label>
|
|
<input type="number" name="checker[security][rate_limit][block_duration]" value="<?= $checker['security']['rate_limit']['block_duration'] ?? 60 ?>" class="form-control" min="1" max="10080">
|
|
<small class="text-muted">How long to block after exceeding limit</small>
|
|
</div>
|
|
<div class="col-md-6">
|
|
<label class="form-label">Error Message</label>
|
|
<input type="text" name="checker[security][rate_limit][error_message]" value="<?= $checker['security']['rate_limit']['error_message'] ?? 'Too many attempts. Please try again later.' ?>" class="form-control">
|
|
<small class="text-muted">Message shown when blocked</small>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</td>
|
|
</tr>
|
|
<tr class="has-link" style="display: none;">
|
|
<th>Google reCAPTCHA v3</th>
|
|
<td>
|
|
<p class="text-muted small mb-3">Invisible CAPTCHA protection. <a href="https://www.google.com/recaptcha/admin" target="_blank">Get keys here</a></p>
|
|
|
|
<div class="form-check mb-3">
|
|
<input class="form-check-input" type="checkbox" value="yes" id="security-recaptcha-enabled" name="checker[security][recaptcha][enabled]" <?= isset($checker['security']['recaptcha']['enabled']) && $checker['security']['recaptcha']['enabled'] == 'yes' ? 'checked' : '' ?>>
|
|
<label class="form-check-label fw-bold" for="security-recaptcha-enabled">
|
|
Enable reCAPTCHA v3
|
|
</label>
|
|
</div>
|
|
|
|
<div class="recaptcha-settings" style="<?= isset($checker['security']['recaptcha']['enabled']) && $checker['security']['recaptcha']['enabled'] == 'yes' ? '' : 'display:none;' ?>">
|
|
<div class="row mb-3">
|
|
<div class="col-md-6">
|
|
<label class="form-label">Site Key</label>
|
|
<input type="text" name="checker[security][recaptcha][site_key]" value="<?= $checker['security']['recaptcha']['site_key'] ?? '' ?>" class="form-control" placeholder="6Lc...">
|
|
<small class="text-muted">Public key for frontend</small>
|
|
</div>
|
|
<div class="col-md-6">
|
|
<label class="form-label">Secret Key</label>
|
|
<input type="text" name="checker[security][recaptcha][secret_key]" value="<?= $checker['security']['recaptcha']['secret_key'] ?? '' ?>" class="form-control" placeholder="6Lc...">
|
|
<small class="text-muted">Private key for backend verification</small>
|
|
</div>
|
|
</div>
|
|
<div class="row mb-3">
|
|
<div class="col-md-6">
|
|
<label class="form-label">Minimum Score</label>
|
|
<input type="number" name="checker[security][recaptcha][min_score]" value="<?= $checker['security']['recaptcha']['min_score'] ?? 0.5 ?>" class="form-control" min="0" max="1" step="0.1">
|
|
<small class="text-muted">0.0 (bot) to 1.0 (human). Recommended: 0.5</small>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</td>
|
|
</tr>
|
|
<tr class="has-link" style="display: none;">
|
|
<th>Cloudflare Turnstile</th>
|
|
<td>
|
|
<p class="text-muted small mb-3">Privacy-friendly CAPTCHA alternative. <a href="https://dash.cloudflare.com/?to=/:account/turnstile" target="_blank">Get keys here</a></p>
|
|
|
|
<div class="form-check mb-3">
|
|
<input class="form-check-input" type="checkbox" value="yes" id="security-turnstile-enabled" name="checker[security][turnstile][enabled]" <?= isset($checker['security']['turnstile']['enabled']) && $checker['security']['turnstile']['enabled'] == 'yes' ? 'checked' : '' ?>>
|
|
<label class="form-check-label fw-bold" for="security-turnstile-enabled">
|
|
Enable Cloudflare Turnstile
|
|
</label>
|
|
</div>
|
|
|
|
<div class="turnstile-settings" style="<?= isset($checker['security']['turnstile']['enabled']) && $checker['security']['turnstile']['enabled'] == 'yes' ? '' : 'display:none;' ?>">
|
|
<div class="row mb-3">
|
|
<div class="col-md-6">
|
|
<label class="form-label">Site Key</label>
|
|
<input type="text" name="checker[security][turnstile][site_key]" value="<?= $checker['security']['turnstile']['site_key'] ?? '' ?>" class="form-control" placeholder="0x4AAA...">
|
|
<small class="text-muted">Public key for frontend</small>
|
|
</div>
|
|
<div class="col-md-6">
|
|
<label class="form-label">Secret Key</label>
|
|
<input type="text" name="checker[security][turnstile][secret_key]" value="<?= $checker['security']['turnstile']['secret_key'] ?? '' ?>" class="form-control" placeholder="0x4AAA...">
|
|
<small class="text-muted">Private key for backend verification</small>
|
|
</div>
|
|
</div>
|
|
<div class="row mb-3">
|
|
<div class="col-md-6">
|
|
<label class="form-label">Theme</label>
|
|
<select name="checker[security][turnstile][theme]" class="form-select">
|
|
<option value="light" <?= isset($checker['security']['turnstile']['theme']) && $checker['security']['turnstile']['theme'] == 'light' ? 'selected' : '' ?>>Light</option>
|
|
<option value="dark" <?= isset($checker['security']['turnstile']['theme']) && $checker['security']['turnstile']['theme'] == 'dark' ? 'selected' : '' ?>>Dark</option>
|
|
<option value="auto" <?= isset($checker['security']['turnstile']['theme']) && $checker['security']['turnstile']['theme'] == 'auto' ? 'selected' : '' ?>>Auto</option>
|
|
</select>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</td>
|
|
</tr>
|
|
<tr class="has-link" style="display: none;">
|
|
<th colspan="2">
|
|
<div class="alert alert-info mb-0">
|
|
<strong>Note:</strong> Only enable ONE CAPTCHA solution at a time. reCAPTCHA and Turnstile cannot be used together.
|
|
</div>
|
|
</th>
|
|
</tr>
|
|
</tbody>
|
|
</table>
|
|
|
|
<script>
|
|
jQuery(document).ready(function($){
|
|
// Toggle rate limit settings
|
|
$('#security-rate-limit-enabled').on('change', function(){
|
|
if($(this).is(':checked')){
|
|
$('.rate-limit-settings').slideDown();
|
|
}else{
|
|
$('.rate-limit-settings').slideUp();
|
|
}
|
|
});
|
|
|
|
// Toggle reCAPTCHA settings
|
|
$('#security-recaptcha-enabled').on('change', function(){
|
|
if($(this).is(':checked')){
|
|
$('.recaptcha-settings').slideDown();
|
|
// Disable Turnstile if reCAPTCHA is enabled
|
|
if($('#security-turnstile-enabled').is(':checked')){
|
|
$('#security-turnstile-enabled').prop('checked', false).trigger('change');
|
|
alert('reCAPTCHA enabled. Turnstile has been disabled.');
|
|
}
|
|
}else{
|
|
$('.recaptcha-settings').slideUp();
|
|
}
|
|
});
|
|
|
|
// Toggle Turnstile settings
|
|
$('#security-turnstile-enabled').on('change', function(){
|
|
if($(this).is(':checked')){
|
|
$('.turnstile-settings').slideDown();
|
|
// Disable reCAPTCHA if Turnstile is enabled
|
|
if($('#security-recaptcha-enabled').is(':checked')){
|
|
$('#security-recaptcha-enabled').prop('checked', false).trigger('change');
|
|
alert('Turnstile enabled. reCAPTCHA has been disabled.');
|
|
}
|
|
}else{
|
|
$('.turnstile-settings').slideUp();
|
|
}
|
|
});
|
|
});
|
|
</script>
|