SpamBlocker

Spam Blocker is a CakePHP Behavior that automatically before after a comment is made. Each comment is tested upon a point system to determine if it should be approved, set to pending (high points), or marked as spam / deleted (low points).

Obfuscate

Scrambles the source of a string. Converts characters to their ASCII alternatives and spoofs bots.

Function: obfuscate()
Category: PHP
Views: 1,022
Permalink - Tinylink

/**
 * Scrambles the source of a string
 * @param string $text
 * @return string
 */
function obfuscate($text) {
	$length = mb_strlen($text);
	$scrambled = '';
 
	if ($length > 0) {
		for ($i = 0; $i < $length; ++$i) {
			$scrambled .= '&#' . ord(mb_substr($text, $i, 1)) . ';';
		}
	}
 
	return $scrambled;
}

Return to Snippets