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).
Generate Random String
Generates a string of random characters. Can determine the length.
Function: generateString()
Category: PHP
Views: 953
Permalink -
Tinylink
/** * Generates a string of random characters * @param int $length * @return string */ function generateString($length = 10) { $characters = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890'; $return = ''; if ($length > 0) { $totalChars = mb_strlen($characters) - 1; for ($i = 0; $i <= $length; ++$i) { $return .= $characters[rand(0, $totalChars)]; } } return $return; }