PHP Classes
elePHPant
Icontem

Random key value pair authentication: Authenticate human users using random value pairs

Recommend this page to a friend!
  Info   View files Example   View files View files (3)   DownloadInstall with Composer Download .zip   Reputation   Support forum (2)   Blog    
Last Updated Ratings Unique User Downloads Download Rankings
2017-10-14 (1 month ago) RSS 2.0 feedNot enough user ratingsTotal: 114 This week: 2All time: 8,721 This week: 345Up
Version License PHP version Categories
rndkvp 1.0.0Public Domain5.6PHP 5, User Management, Validation, S...
Description Author

This class can authenticate human users using random value pairs.

It can generate two random strings that will be used as key-value pairs stored in the current user session variables.

The class can generate HTML for a hidden input with using the generated key as input name and the value as input value.

Then the class can validate if the user is valid checking if the submitted form values match what is stored in the session variables.

Recommendations

Captcha process for multiple php program files
Form page has to screen out non-humans to upload product images

  Performance   Level  
Name: Dave Smith is available for providing paid consulting. Contact Dave Smith .
Classes: 36 packages by
Country: United States United States
Age: 52
All time rank: 13814 in United States United States
Week rank: 1 Up
Innovation award
Innovation award
Nominee: 25x

Winner: 6x

Details
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
  Files folder image Files  
File Role Description
Accessible without login Plain text file manual.txt Doc. Usage Documentation
Plain text file rndkvp.class.php Class Main Class
Accessible without login Plain text file test.php Example Test usage

 Version Control Unique User Downloads Download Rankings  
 0%
Total:114
This week:2
All time:8,721
This week:345Up
User Comments (1)