What are common methods used to prevent guestbook spam in PHP forums?

Guestbook spam in PHP forums can be prevented by implementing CAPTCHA verification, using moderation for guestbook entries, and implementing IP address filtering to block known spamming IPs.

// Example PHP code snippet for preventing guestbook spam using CAPTCHA verification

// Generate a random CAPTCHA code
$captcha = substr(md5(rand()), 0, 6);

// Store the CAPTCHA code in a session variable
$_SESSION['captcha'] = $captcha;

// Display the CAPTCHA image in the guestbook form
echo "<img src='captcha_image.php' alt='CAPTCHA Image'>";

// Validate the CAPTCHA code entered by the user
if(isset($_POST['captcha']) && $_POST['captcha'] == $_SESSION['captcha']) {
    // Process the guestbook entry
} else {
    // Display an error message and prompt the user to try again
}