From ced5a6512296413ff77eb8dd0d0f47d3328fef62 Mon Sep 17 00:00:00 2001 From: Joshua Ramon Enslin Date: Sun, 14 Aug 2022 16:17:03 +0200 Subject: [PATCH] Fix variable misnomers in MD_STD_SEC --- src/MD_STD_SEC.php | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/MD_STD_SEC.php b/src/MD_STD_SEC.php index b39d387..320e18e 100644 --- a/src/MD_STD_SEC.php +++ b/src/MD_STD_SEC.php @@ -87,7 +87,7 @@ final class MD_STD_SEC { $delay_micoseconds = max($max - 1, 1) * 1000000; } - return rand($delay_micoseconds - 100000, $delay_micoseconds); + return max(0, rand($delay_micoseconds - 100000, $delay_micoseconds)); } @@ -97,6 +97,7 @@ final class MD_STD_SEC { * @param string $tool_name Identifier of the login. * @param string $username Username to look for. * @param integer $max_execution_time Optional maximum execution time to stay below. + * In seconds. * * @return boolean */ @@ -154,10 +155,12 @@ final class MD_STD_SEC { $delay_multiplier_per_ip, $max_execution_time); + \error_log("Logged in: " . $username . "; Delay: " . ($delay_micoseconds / 1000000) . " seconds"); + // Sleep \usleep($delay_micoseconds); - if ($delay_micoseconds > \abs($max_execution_microseconds - 1000000)) { + if ($delay_micoseconds > \abs($max_execution_time - 1000000)) { return false; }