PHP code example of osmo / auth

1. Go to this page and download the library: Download osmo/auth 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/ */

    

osmo / auth example snippets


   

$con = new Osmo\Database([
    'username' => 'root',
    'database' => 'system',
    'password' => 'password'
  //'table'    => 'users_system' 
]);
//Default value {users}
//$con->setTable('users_table');

$auth = new Osmo\Auth($con, ['email', 'password']);

if ($auth->isPost()) {
    $auth->make($auth->inputEmailAddress(), $auth->input('password'), 'md5');
}

$auth->make($auth->input('email'), $auth->input('password'), 'crypt');

$auth->make($auth->input('email'), $auth->input('password'));

$auth->make($auth->inputEmailAddress(), $auth->input('password'), 'md5', function (){
    Osmo\Response::redirect('/');
});

if(Osmo\SessionManager::auth()) {
    //
}

Osmo\SessionManager::destroy();