1. Go to this page and download the library: Download tigo/login-session library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
tigo / login-session example snippets
// the function must return a boolean value.
public function postLogin()
{
$user = isset($_POST[self::USER]) ? $_POST[self::USER] : false;
$pw = isset($_POST[self::PW]) ? md5($_POST[self::PW]) : false;
$table = TestMatrix::table();
foreach ($table as $key => $item) {
if($user == $item->user && $pw == $item->password){
$_SESSION[self::SESSION] = $_POST[self::USER];
return true;
}
}
return false;
}
public static function table()
{
return [
1=> (object) ["user"=>"admin","password"=>md5("123")],
2=> (object) ["user"=>"admin2","password"=>md5("1234")],
3=> (object) ["user"=>"admin3","password"=>md5("12345")]
];
}
use Tigo\LoginSession\Login; // import class
$login = new Login();
$login->validate();
In the src/config/Standard.php directory
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.