PHP Classes

PHP Login Pad Class: Display and validate digits for the user to enter

Recommend this page to a friend!
  Info   View files Example   Demos   Screenshots Screenshots   View files View files (3)   DownloadInstall with Composer Download .zip   Reputation   Support forum (2)   Blog (1)    
Ratings Unique User Downloads Download Rankings
Not enough user ratingsTotal: 159 All time: 8,982 This week: 488Up
Version License PHP version Categories
loginpadclass 0.4GNU General Publi...5HTML, Validation, Security


This class can display and validate digits for the user to enter.

It can take code made of digits from 0 to 9 and renders a pad arranged randomly made of 16 buttons that the user needs to click on the right buttons to match the validate code digits.

The class can also check if the user has clicked on the right buttons with digits that match the code that was provided initially.

Depending on the configuration of the class, the code can be typed on the keyboard or necessarily with the mouse. It can optionally be used to avoid robots.

Innovation Award
PHP Programming Innovation award nominee
January 2021
Number 3

Prize: SourceGuarding PHP encoder tool
Some times it is necessary that applications verify if a user accessing the site is a real human, rather than a robot script that its trying to abuse from the system resources.

This class provides a solution that consists of a key pad that displays on a Web page. Then the users need to click or touch on keys that appear on the screen to demonstrate that they are real humans to enter the right codes by the right order.

This way this solution can work well on computers on which people can use the mouse to point and click in the buttons in the right order with the codes that appear on the page.

It also works well on devices with a touch screen like mobile phones, tablets or computers with a touch screen, as the users just need to touch the buttons to achieve the same effect as clicking on the buttons using the mouse.

Manuel Lemos
Picture of Pierre FAUQUE
  Performance   Level  
Name: Pierre FAUQUE <contact>
Classes: 18 packages by
Country: France France
Age: 77
All time rank: 15312 in France France
Week rank: 280 Down11 in France France Up
Innovation award
Innovation award
Nominee: 12x

Winner: 1x



$kp = new loginPad("17081936",1); // Instanciation with the access code
$kp->rep = 0; // 1:report error (default), 0: don't report anything

if(isset($_POST["submit"])) {
$kp->isGoodInput()) {
// header("location: access.php"); // Access to the right page
        // header("location:"); // Download a file
        // ... Or other action...
echo "<!DOCTYPE html>\n";
"<title>Authorized page</title>\n";
"<style type=\"text/css\">\n";
"body { font-family:arial; font-size:1em }\n";
"img { margin-left:25px; border:1px solid grey }\n";
"<h1>Correct code</h1>\n";
"<p>The code is correct. You can do what you want :\n";
"<li> display a new page,</li>\n";
"<li> delete a record,</li>\n";
"<li> start a download,</li>\n";
"<li> etc.</li>\n";
"<p>Margaret Hamilton and it's Appolo code :<br/>&nbsp;<br/>";
"<img src=\"Appolo-code-of-Margaret-Hamilton.jpg\"></p>\n";
        die(); }
    else {
?><!DOCTYPE html>

<title>Test page</title>
<style type="text/css">
p { font-family:arial; font-size:1em }
a { text-decoration:none }
a:hover { color:red }

  Click on the keys to enter the access code and validate<br/>
  with the Send button (or cancel with the Clear button)<br/>
  NB: The code is 17081936 (birthday of <a href="" target="_blank">Margaret Hamilton</a>)

<?php $kp->writeKeypad(); ?>

<p><a href="index1.php">Try with no code input zone</a></p>



  Démo on the author's websiteExternal page  
  • screenshots.jpg
  Files folder image Files  
File Role Description
Plain text file class.loginPad.php Class The class itself (user guide included)
Accessible without login Plain text file index.php Example Example of use
Accessible without login Plain text file README.txt Data Summary (URL and PGP Key)

 Version Control Unique User Downloads Download Rankings  
This week:0
All time:8,982
This week:488Up
User Comments (1)
Great little piece of code.
3 years ago (Valentin)