Products in Clothing & Fashion
Showing 4 of 4 products
/** * Stricter, IP-independent throttle for admin identifiers. * Returns true if login may proceed; false if the admin identifier has * exceeded $maxAttempts failures in the last $windowMinutes (any IP). */ if (!function_exists('checkAdminLoginLockout')) { function checkAdminLoginLockout($identifier, $maxAttempts = 10, $windowMinutes = 60) { $db = Database::getInstance()->getConnection(); try { $idCols = la_identifier_columns($db); if (empty($idCols)) return true; $whereParts = []; $params = []; foreach ($idCols as $c) { $whereParts[] = "{$c} = ?"; $params[] = $identifier; } $idWhere = '(' . implode(' OR ', $whereParts) . ')'; $minutes = (int)$windowMinutes; $sql = "SELECT COUNT(*) FROM login_attempts WHERE {$idWhere} AND attempted_at > DATE_SUB(NOW(), INTERVAL {$minutes} MINUTE) AND success = 0"; $stmt = $db->prepare($sql); $stmt->execute($params); return ((int)$stmt->fetchColumn()) < $maxAttempts; } catch (Throwable $e) { return true; } } }
Showing 4 of 4 products