Browse Source

Wrap auth with getConfig(), thx @mp035

pull/799/head
billz 10 months ago
parent
commit
bdafa8dfbd
  1. 1
      index.php
  2. 23
      raspap.php

1
index.php

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

23
raspap.php

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