prepare(" SELECT COUNT(*) FROM phplist_user_user_history h JOIN phplist_user_user u ON u.id = h.userid WHERE u.email = :email AND h.summary IN ('Subscription', 'Re-Subscription') AND h.date >= (NOW() - INTERVAL 24 HOUR) "); $stmt->execute(['email' => $targetEmail]); $recentAttempts = (int) $stmt->fetchColumn(); if ($recentAttempts >= 2) { header('HTTP/1.1 429 Too Many Requests'); exit('Please wait before trying again.'); } } catch (Exception $e) { // Bei DB-Fehler nicht blockieren, normal weiterlaufen lassen } }