/**
 * Check for the valid data about spam and js
 * 
 * @param  string $prt The spam post field name
 * @param  string $js  The js post file name
 * 
 * @return bool
 */
function checkJsAndSpam($prt = 'prt', $js = 'imJsCheck')
{
    // Spam!
    if ($_POST[$prt] != "") {
        return false;
    }
    // Javascript disabled
    if (!isset($_POST[$js]) || $_POST[$js] != 'jsactive') {
        echo imPrintJsError(false);
        return false;
    }
    return true;
}
<?php

if (substr(basename($_SERVER['PHP_SELF']), 0, 11) == "imEmailForm") {
    include '../res/x5engine.php';
    $form = new ImForm();
    $form->setField('', $_POST['imObjectForm_1_1'], '', false);
    $form->setField('', $_POST['imObjectForm_1_2'], '', false);
    if (@$_POST['action'] != 'check_answer') {
        if (!isset($_POST['imJsCheck']) || $_POST['imJsCheck'] != 'jsactive' || isset($_POST['imSpProt']) && $_POST['imSpProt'] != "") {
            die(imPrintJsError());
        }
        $form->mailToOwner('*****@*****.**', '*****@*****.**', '', '', true);
        @header('Location: ../index.html');
        exit;
    } else {
        echo $form->checkAnswer(@$_POST['id'], @$_POST['answer']) ? 1 : 0;
    }
}
// End of file