PHP code example of leonardini / brontosaurus

1. Go to this page and download the library: Download leonardini/brontosaurus 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/ */

    

leonardini / brontosaurus example snippets




// It is extremely important that a descriptive form name is provided as parameter, because tokens must be strictly linked to every form of your website
$token = \Brontosaurus\FormToken\generateToken("form_name");

// The token must be sent to the server in a 'form_token' parameter, for security only POST request are supported
echo "<input type=\"hidden\" name=\"form_token\" value=\"$token\">";
// The form name must be sent in a 'form_name' parameter, too
echo "<input type=\"hidden\" name=\"form_name\" value=\"form_name\">";

$validation = \Brontosaurus\FormToken\validateToken("form_name");

if($validation->isSuccessful()) {
    // The token comes from your form
} else {
    // The token has not passed the check
}

\Brontosaurus\Config::loadFromFile(__DIR__."/config.yml");

\Brontosaurus\Config::unloadConfig();