PHP Classes

File: manual.txt

Recommend this page to a friend!
  Classes of Dave Smith   Random key value pair authentication   manual.txt   Download  
File: manual.txt
Role: Documentation
Content type: text/plain
Description: Usage Documentation
Class: Random key value pair authentication
Authenticate human users using random value pairs
Author: By
Last change:
Date: 6 years ago
Size: 1,727 bytes
 

Contents

Class file image Download
Class: random key value pair authentication Version: 0.1 10/14/2017 Released into the public domain Description: This class will authenticate human submissions through random key value pairs. Installation: Upload files to a web accessible location on your server (eg. public_html) Configuration: No configuration needed. Usage: This class uses a serialized object to store the last key value pair for authentication in the session. If you don't know what I am talking about, that is okay, it just means that you must instantiate the class after the session has been started. This allows human verification without any intreaction with the human. session_start(); include('rndkvp.class.php'); if( empty($_SESSION['humanCheck']) ){ $humanCheck = new rndkvp(10); }else{ $humanCheck = unserialize($_SESSION['humanCheck']); } 1. If the session has not been started elsewhere, start it before instantiating the class. 2. Include the class file. 3. If the class object has not already been saved to the session, instantiate as normal, otherwise load it from the session. rndkvp takes 1 argument... length = length of the generated key value pairs, defaults to 8 After all processing has been completed, the object must be saved to the session... $_SESSION['humanCheck'] = serialize($humanCheck); Refer to the test.php file for usage examples. Point your browser to this file to see how it works. Methods createFormInput() creates a hidden input form field containing the random key value pairs validate( $value ) validates the submitted value resetKVP( $length ) generates new random key value pairs Changelog 0.1 Initial beta release