From 8d291d0c7dbc2c9f8b48505cffe15d60c269ddcd Mon Sep 17 00:00:00 2001 From: Fluffy-Bean Date: Thu, 15 Sep 2022 17:13:36 +0000 Subject: [PATCH] Finalised Ban/Log system --- account.php | 4 +- app/account/account.php | 318 ++++++++++++++++++++++------------------ 2 files changed, 177 insertions(+), 145 deletions(-) diff --git a/account.php b/account.php index c99fcce..12b8ccd 100644 --- a/account.php +++ b/account.php @@ -72,7 +72,7 @@ ?>
-

Bans/Timeouts

+

Bans

-

+

mins

" . $log_time->format('d/m/Y H:i:s T') . "
" . $diff->time($ban['time']) . "

"; diff --git a/app/account/account.php b/app/account/account.php index f8aa2d7..fabe6a8 100644 --- a/app/account/account.php +++ b/app/account/account.php @@ -19,20 +19,10 @@ $user_ip = $user_info->get_ip(); |------------------------------------------------------------- */ if (isset($_POST['submit_login'])) { - /* - |------------------------------------------------------------- - | Set error status to 0 - |------------------------------------------------------------- - | if there are more than 0 error, then they cannot submit a - | request - |------------------------------------------------------------- - */ $error = 0; + $ban_query = mysqli_query($conn, "SELECT * FROM bans WHERE ipaddress = '$user_ip' ORDER BY id DESC LIMIT 1"); - $sql = "SELECT * FROM bans WHERE ipaddress = '$user_ip' ORDER BY id DESC LIMIT 1"; - $query = mysqli_query($conn, $sql); - - while ($ban_check = mysqli_fetch_assoc($query)) { + while ($ban_check = mysqli_fetch_assoc($ban_query)) { $ban_time = $ban_check['time']; $ban_perm = $ban_check['permanent']; } @@ -45,55 +35,60 @@ if (isset($_POST['submit_login'])) { sniffleAdd('Bye bye!', 'You have been banned, contact the owner if you feel that this was a mistake', 'var(--red)', 'assets/icons/warning.svg'); = 5) { mysqli_query($conn,"INSERT INTO bans (ipaddress, reason, length, permanent) VALUES('$user_ip','Attempted password too many times', '60', '0')"); - } else { - // Checking if Username is empty - if (empty(trim($_POST["username"]))) { - ?> - - - - + + + + - - - - = 5) { + mysqli_query($conn,"INSERT INTO bans (ipaddress, reason, length, permanent) VALUES('$user_ip','Attempted password too many times', '60', '0')"); } } - // Validate sussness of Password - if (empty(trim($_POST["password"]))) { - // No password entered - ?> - - - - - - + + + + + + + + + + + + + +