PHP Classes

File: example.php

Recommend this page to a friend!
Stumble It! Stumble It! Bookmark in Bookmark in
  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: 8 years ago
Size: 1,056 bytes


Class file image Download
$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
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)); ?>
<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" />