0) { $error = 'Too many failed attempts. Try again in ' . ceil($lock / 60) . ' min.'; } elseif (auth_attempt((string)($_POST['username'] ?? ''), (string)($_POST['password'] ?? ''))) { redirect('index.php'); } else { $lock = auth_locked_for(); $error = $lock > 0 ? 'Too many failed attempts. Try again in ' . ceil($lock / 60) . ' min.' : 'Invalid username or password.'; } } ?>