<?php require_once('../config.inc.en');
require_once('php/secform.inc');
# 1. initialize method: 0 – only token – "invisible"
$secform = new tucal_secform(0);
seite(__FILE__);
if (isset($_POST['email'])) {
# 3. Form evaluation
# method 0 - without time check
list($ok, $reason) = $secform->check_token();
if ($ok) {
# general form evaluation
echo '<p>Ok</p><ul><li><a href="mod_secform0.php.en">back to this example</a></li>';
echo '<li><a href="../secform.html.en#ex">back to list of all examples</a></li>';
echo '<li>Check: Reloading the page should be detected</li></ul>';
return;
} else {
# output error, e.g. $reason, and/or simply display form again
echo 'Error: ' . htmlspecialchars($reason);
}
}
# Empty form:
?>
<h1 class="linie">Form</h1>
<form action="mod_secform0.php.en" method="post" class="form-horizontal">
<div class="form-group">
<label for="EMail" class="col-xm-3 control-label">E-mail address</label>
<div class="col-xm-9">
<input type="email" class="form-control" id="EMail" name="email" placeholder="name@domain">
</div>
</div>
<div class="form-group">
<div class="col-xm-offset-3 col-xm-9">
<div class="checkbox">
<label> <input type="checkbox" name="check"> Click me </label>
</div>
<?php echo $secform->get_token(); ?>
<button type="submit" class="btn btn-default" style="margin:1em 0">Send</button>
</div>
</div>
</form>
<p><a href="../secform.html.en#ex">back to list of all examples</a></p>
Show output with this program code