/**
  * Check if the form is submitted by validating the value of the hidden
  * vf__dispatch field.
  *
  * @param boolean $blnForce
  *            Fake isSubmitted to true to force field values.
  * @return boolean [description]
  */
 public function isSubmitted($blnForce = false)
 {
     if (ValidForm::get("vf__dispatch") == $this->__name || $blnForce) {
         if ($this->__usecsrfprotection && !$blnForce) {
             return CSRF::validate($_POST);
         } else {
             return true;
         }
     } else {
         return false;
     }
 }
Ejemplo n.º 2
0
<?php

require 'vendor/autoload.php';
require 'app/funcs.php';
use Gum\Route as Gum;
Gum::get('/', function () {
    echo tpl('xannybakes', array('csrf' => \Volnix\CSRF\CSRF::getHiddenInputString()));
});
Gum::post('/contact', function () {
    $mandrill = new Mandrill('');
    // @TODO: get from env var
    $name = htmlspecialchars($_POST['name']);
    $email = htmlspecialchars($_POST['email']);
    $body = htmlspecialchars($_POST['body']);
    $message = array('text' => $body, 'subject' => 'Someone contacted you via your website!', 'from_email' => $email, 'from_name' => $name, 'to' => array(array('email' => '*****@*****.**', 'name' => 'Adrian Unger', 'type' => 'to')));
    $result = $mandrill->messages->send($message);
    print_r($result);
});
// handle 404
if (Gum::not_found()) {
    header('HTTP/1.0 404 Not Found');
    echo '404 Not Found';
    exit;
}
Ejemplo n.º 3
0
 public function testGetAsArray()
 {
     $token = CSRFTokenGenerator::getToken();
 }