PHP Classes

File: index.php

Recommend this page to a friend!
  Classes of Pierre FAUQUE   PHP Login Pad Class   index.php   Download  
File: index.php
Role: Example script
Content type: text/plain
Description: Example of use
Class: PHP Login Pad Class
Display and validate digits for the user to enter
Author: By
Last change: New version of the class (show or not a report error)
Date: 3 years ago
Size: 1,908 bytes
 

Contents

Class file image Download
<?php
require("class.loginPad.php");

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

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

<body>
<p>
  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="https://en.wikipedia.org/wiki/Margaret_Hamilton_(software_engineer)" target="_blank">Margaret Hamilton</a>)
</p>

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

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

</body>

</html>