Collections functions
Encryption functions
General functions
Render functions
Theme permission functions
Video functions
Resource functions

api_login()

Description

API login function

Parameters

ColumnTypeDefaultDescription
$username string Username
$password string Password to validate

Return

string|false FALSE if invalid, session API key if valid

Location

include/api_functions.php lines 380 to 392

Definition

 
function api_login($username,$password)
    {
    global 
$session_hash$scramble_key;
    
$user=get_user_by_username($username); if ($user===false) {return false;}
    
$result perform_login($username,$password);
    
$private_key get_api_key($user);
    if ((bool)
$result['valid'])
        {
        return 
hash_hmac("sha256""{$session_hash}{$private_key}"$scramble_key);
        }

    return 
false;
    }

This article was last updated 28th February 2021 14:35 Europe/London time based on the source file dated 9th February 2021 12:45 Europe/London time.