Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
sucssite
sso
Compare Revisions
4f4939e53a4a8cd40899ac00d62a178918fae8db...48078284ca8cb62283ffa99b6bbcc3b565c54d83
Commits (2)
Fix some ban logic to be nicer to legit people
· dc4bc354
Imran Hussain
authored
Dec 22, 2021
dc4bc354
Merge branch 'ban-logic-fix' into 'master'
· 48078284
Imran Hussain
authored
Dec 22, 2021
Fix some ban logic to be nicer to legit people See merge request
!5
48078284
Show whitespace changes
Inline
Side-by-side
public/index.php
View file @
48078284
...
...
@@ -36,7 +36,7 @@ $ipBan_details = $ipBan_result->fetchArray();
// if their last login attempt was less than 30 mins ago
// 30 mins to really punish ban avoiders
if
(
$ipBan_details
[
"lastfailedlogintime"
]
<
=
strtotime
(
"-30 minutes"
))
{
if
(
$ipBan_details
[
"id"
]
!==
$SESSIONID
&&
$ipBan_details
[
"lastfailedlogintime"
]
>
=
strtotime
(
"-30 minutes"
)
)
{
$RATELIMITED
=
true
;
}
...
...
@@ -55,7 +55,8 @@ if ( $details["id"] === $SESSIONID && !$RATELIMITED) {
if
(
$details
[
"iss_username"
]
!==
null
)
{
$ISS_LOGIN
=
true
;
}
if
(
$details
[
"lastfailedlogintime"
]
<=
strtotime
(
"-10 minutes"
))
{
// every 10 minutes give people not clearing their cookies 1 more go
if
(
$details
[
"failedlogincount"
]
>=
3
&&
$details
[
"lastfailedlogintime"
]
<=
strtotime
(
"-10 minutes"
))
{
$details
[
"failedlogincount"
]
=
2
;
}
if
(
$details
[
"failedlogincount"
]
>=
3
)
{
...
...
@@ -95,6 +96,9 @@ if ( isset($_POST["username"]) && isset($_POST["password"]) && !$RATELIMITED ) {
//do stuff for not authd peeps
$details
[
"failedlogincount"
]
=
$details
[
"failedlogincount"
]
+
1
;
$DB_CON
->
exec
(
"UPDATE sessions SET failedlogincount=${details['failedlogincount']}, lastfailedlogintime=strftime('%s','now') WHERE id='${SESSIONID}'"
);
if
(
$details
[
"failedlogincount"
]
>=
3
)
{
$RATELIMITED
=
true
;
}
}
}
elseif
(
isset
(
$_COOKIE
[
"sucssite_session"
])
&&
!
$RATELIMITED
)
{
...
...