PHP Classes

PHP Secret URL Path: Authorize access based on user click sequence

Recommend this page to a friend!
  Info   View files Example   View files View files (5)   DownloadInstall with Composer Download .zip   Reputation   Support forum (1)   Blog (2)    
Ratings Unique User Downloads Download Rankings
StarStarStarStar 78%Total: 540 This week: 1All time: 5,571 This week: 172Up
Version License PHP version Categories
secret-path 1.1GNU General Publi...5PHP 5, User Management, Security


This class can authorize access based on user click sequence.

It takes an array of values and checks if the user has clicked on links with parameter values that follow the sequence of values in the array.

The class object is stored in a session variable, so in the next access the class can check if the correct link was clicked passing the next value in the array.

Innovation Award
PHP Programming Innovation award winner
November 2016

Prize: One downloadable copy of PhpED Professional
Passwords are the most common way to authenticate users. However, if somebody sees a user typing a password, the password may be stolen and the user account may be taken over.

A better approach is used by some bank ATMs. They show a bunch of buttons with lists of letter and number sequences on each button. The user has to use the right buttons by the correct sequence.

Since the buttons show different types of letter and number groups, even if somebody sees which buttons the user pressed, he will not know exactly what is the correct sequence.

This class provides means to implement a similar security system in PHP. It presents a list of links with values that the user needs to click, one after another by the correct sequence to be authenticated successfully.

Manuel Lemos
Picture of Dave Smith
  Performance   Level  
Name: Dave Smith is available for providing paid consulting. Contact Dave Smith .
Classes: 51 packages by
Country: United States United States
Age: 58
All time rank: 618 in United States United States
Week rank: 12 Up2 in United States United States Up
Innovation award
Innovation award
Nominee: 32x

Winner: 7x


secretPath class
version 1.0 10/21/2016

Authorize access based on the sequence of user clicks

//start session - sequence saved in $_SESSION super global

//include class source

//instantiate the class or define class object from saved data
if( empty($_SESSION['secpth']) ){
$path = array(1,2,3,2,2);
$secpth = new secretPath('link',$path);
$secpth = unserialize($_SESSION['secpth']);

//test user click sequence and send to secret page if sequence completed
if( $secpth->validatePath() === true ){
//it is important to save the class object before re-directing
$_SESSION['secpth'] = serialize($secpth);
header('location: secret.php');

//save class object to session
$_SESSION['secpth'] = serialize($secpth);

        <title>Secret Path Example</title>
        Default secret path is link: 1,2,3,2,2<br><br>
        <a href="example.php?link=1">Link 1</a><br>
        <a href="example.php?link=2">Link 2</a><br>
        <a href="example.php?link=3">Link 3</a><br>

  Files folder image Files  
File Role Description
Accessible without login Plain text file example.php Example Usage Example
Accessible without login Plain text file license.txt Lic. License
Accessible without login Plain text file manual.txt Doc. Documentation
Accessible without login Plain text file secret.php Example Authentication Example
Plain text file secretpath.class.php Class Main Class

 Version Control Unique User Downloads Download Rankings  
This week:1
All time:5,571
This week:172Up
User Ratings User Comments (1)
 All time