<?php require_once('../config.inc.en');
require_once('php/secform.inc');
# 1. initialize method: 1 – token and time check – "invisible"
$secform = new tucal_secform(1);
seite(__FILE__);
if (isset($_POST['email'])) {
# 3. Form evaluation
# time for the user to fill in the form in seconds: min, max
list($ok, $reason) = $secform->check_token(5, 900);
if ($ok) {
# general form evaluation
echo '<p>Ok</p><ul><li><a href="mod_secform1.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_secform1.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