Created
March 24, 2012 21:47
-
-
Save cballou/2188338 to your computer and use it in GitHub Desktop.
SPF30 - A Spam Blocking/Prevention PHP Library
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| require_once('./spf30.php'); | |
| if (!empty($_POST)) { | |
| try { | |
| // this is an example of the form data before decryption | |
| var_dump($_POST); | |
| // run validation on the submitted email form | |
| spam::validate($_POST); | |
| // $_POST now contains decrypted form data | |
| var_dump($_POST); | |
| } catch (Exception $e) { | |
| // an error occurred with the form validation | |
| // ... | |
| die($e->getMessage()); | |
| } | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php require_once('./spf30.php'); ?> | |
| <?php spam::init('POST', 'form-handler.php', 'signupform'); ?> | |
| <?php $name = spam::encryption('name'); ?> | |
| <label>Name</label> | |
| <input type="text" id="<?php echo $name; ?>" name="<?php echo $name; ?>" /> | |
| <?php $email = spam::encryption('email'); ?> | |
| <label>Email Address</label> | |
| <input type="text" id="<?php echo $email; ?>" name="<?php echo $email; ?>" /> | |
| <?php $phone = spam::encryption('phone'); ?> | |
| <label>Phone Number</label> | |
| <input type="text" id="<?php echo $phone; ?>" name="<?php echo $phone; ?>" /> | |
| <?php $comment = spam::encryption('comment'); ?> | |
| <label>Comments</span> | |
| <textarea name="<?php echo $comment; ?>" id="<?php echo $comment; ?>" rows="6" cols="100"></textarea> | |
| <!-- display hidden fields required for validation --> | |
| <?php echo spam::hidden(); ?> | |
| <button type="submit" value="submit">submit</button> | |
| </form> | |
| <!-- encrypts user-defined input on form submission --> | |
| <?php spam::javascript(); ?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment