dyndns/app/Component/Config/File.php

30 lines
737 B
PHP

<?php
namespace App\Component\Config;
class File implements \App\Component\Config\IConfig
{
/*
* config from file
*/
private $config;
public function __construct()
{
$this->config = json_decode(file_get_contents(storage_path(getenv("DYNDNS_CONFIG_FILE"))), true);
}
public function validateUser($username, $password, $domain) : bool
{
foreach ($this->config["accounts"] as $account) {
if($account["username"] == $username) {
if($account["password"] == $password) {
if($account["domain"] == $domain) {
return true;
}
}
}
}
return false;
}
}