PHP code example of zexbre / mathguard

1. Go to this page and download the library: Download zexbre/mathguard library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

zexbre / mathguard example snippets


/* first we need to thGuard\MathGuard;

/* this condition checks the user input. Don't change the condition, just the body within the curly braces */
if (MathGuard :: checkResult($_REQUEST['mathguard_answer'], $_REQUEST['mathguard_code'])) {
    echo ("Great !"); //insert your code that will be executed when user enters the correct answer
} else {
    echo ("Bad answer, go back to school !");	//insert your code which tells the user he is spamming your website
}