Wrap auth with getConfig(), thx @mp035

This commit is contained in:
billz 2021-02-02 10:03:09 +00:00
parent 5c4b84f826
commit bdafa8dfbd
2 changed files with 15 additions and 9 deletions

View File

@ -47,6 +47,7 @@ require_once 'includes/about.php';
require_once 'includes/openvpn.php'; require_once 'includes/openvpn.php';
require_once 'includes/torproxy.php'; require_once 'includes/torproxy.php';
$config = getConfig();
$output = $return = 0; $output = $return = 0;
$page = $_SERVER['REQUEST_URI']; $page = $_SERVER['REQUEST_URI'];

View File

@ -1,14 +1,19 @@
<?php <?php
$config = array( function getConfig()
'admin_user' => 'admin', {
'admin_pass' => '$2y$10$YKIyWAmnQLtiJAy6QgHQ.eCpY4m.HCEbiHaTgN6.acNC6bDElzt.i' $config = array(
); 'admin_user' => 'admin',
'admin_pass' => '$2y$10$YKIyWAmnQLtiJAy6QgHQ.eCpY4m.HCEbiHaTgN6.acNC6bDElzt.i'
);
if (file_exists(RASPI_CONFIG.'/raspap.auth')) { if (file_exists(RASPI_CONFIG . '/raspap.auth')) {
if ($auth_details = fopen(RASPI_CONFIG.'/raspap.auth', 'r')) { if ($auth_details = fopen(RASPI_CONFIG . '/raspap.auth', 'r')) {
$config['admin_user'] = trim(fgets($auth_details)); $config['admin_user'] = trim(fgets($auth_details));
$config['admin_pass'] = trim(fgets($auth_details)); $config['admin_pass'] = trim(fgets($auth_details));
fclose($auth_details); fclose($auth_details);
}
} }
return $config;
} }