<?php
function getApiKey() {
    global $db;

    $defaultApiKey = '484354'; // Default value
    $mes = $db->select('tsdbapi', '*', 'id = :id', '', [':id' => 1]);

    if (!empty($mes)) {
        $methord = $mes[0]['methord'] ?? 'def';
        $key = $mes[0]['key'] ?? '0';

        return ($methord === 'def') ? $defaultApiKey : $key;
    }

    return $defaultApiKey;
}
?>
