add log of failed logins in apache error_log

This commit is contained in:
root 2018-02-13 10:11:37 +01:00
parent c3250e58fc
commit edf80e353b
2 changed files with 12 additions and 0 deletions

11
action.php Normal file
View file

@ -0,0 +1,11 @@
<?php
if(isset($_POST['action']) && !empty($_POST['action'])) {
$action = $_POST['action'];
switch($action) {
case 'failedlogin' :
#error_log("login failed for user ".$_POST['user']." (".$_SERVER['REMOTE_ADDR']), 3, "/tmp/mes-erreurs.log");
error_log("PDNS-MANAGER : login failed for user ".$_POST['user']." (".$_SERVER['REMOTE_ADDR'].")\n", 3, "/var/log/apache2/error.log");
break;
}
}

View file

@ -26,6 +26,7 @@ $(document).ready(function() {
function(data){
if(data.status == "fail") {
$('#alertLoginFailed').slideDown(600);
$.post( "action.php", { action: "failedlogin", user: $('#inputUser').val() } );
} else {
location.assign("domains.php");
}