Login   Register  
PHP Classes
elePHPant
Icontem

File: example.php

Recommend this page to a friend!
Stumble It! Stumble It! Bookmark in del.icio.us Bookmark in del.icio.us
  Classes of Giorgos  >  Form Spam Bot Blocker  >  example.php  >  Download  
File: example.php
Role: Example script
Content type: text/plain
Description: an example of a protected web form
Class: Form Spam Bot Blocker
Generate forms that prevent submission by robots
Author: By
Last change:
Date: 7 years ago
Size: 1,056 bytes
 

Contents

Class file image Download
<?php
require_once("fsbb.php");
$blocker=new formSpamBotBlocker();
$blocker->setTimeWindow(2,30); // Called for test reasons. It must be actually set on the target page!
$blocker->setTrap(true,"mail","Do not enter anything in this field!"); // if set here (to change the defaults), then set it again with the same name on the target page!
$hiddenTags=$blocker->makeTags(); // create the xhtml string containing the required form elements
?>
<html>
<head></head>
<body>
Class version: <?php print $blocker->version?>
<br />Info for the test:
<br />Min time in seconds to submit: <?php print $blocker->minTime?>
<br />Max time in seconds to submit: <?php print $blocker->maxTime?>
<br />The class generated the following tags:<br />
<?php print nl2br(htmlentities($hiddenTags)); ?>
<p>
<form action="action.php" method="post">
<?php print $hiddenTags?>
<label for="message">Message: </label><input type="text" name="message" id="message" value="some text" />
<input type="submit" value="submit" />
</form>
</p>
</body>
</html>