Unify Theme ERROR! on CAPTCHA form.

For the life of me, I couldn’t figure out why the Sky Forms CAPTCHA was showing ERROR! on my Unify Theme Bootstrap 3 deployment.

Turns out this was just a rookie mistake… I wasn’t looking closely enough at the “how it works” and I was missing some code from the demo-contacts.php sample file that was crucial to the operation of the CAPTCHA. This code generates the CAPTCHA itself and stores it in SESSION data. Since it was missing, the CAPTCHA system’s image.php was turning out an ERROR!

// Make the page validate
ini_set('session.use_trans_sid', '0');

// Create a random string, leaving out 'o' to avoid confusion with '0'
$char = strtoupper(substr(str_shuffle('abcdefghjkmnpqrstuvwxyz'), 0, 4));

// Concatenate the random string onto the random numbers
// The font 'Anorexia' doesn't have a character for '8', so the numbers will only go up to 7
// '0' is left out to avoid confusion with 'O'
$str = rand(1, 7) . rand(1, 7) . $char;

// Begin the session

// Set the session contents
$_SESSION['captcha_id'] = $str;

That $_SESSION[‘captcha_id’] is what the image.php file is looking for. If it doesn’t find it, ERROR!

Refresh, and we’re good to go!