diff --git a/index.php b/index.php index 1e8976e..c0c2c18 100644 --- a/index.php +++ b/index.php @@ -1,7 +1,24 @@ '/etc/ppp/chap-secrets', + 'admin_username' => 'admin', + 'admin_password' => password_hash('change@me', PASSWORD_DEFAULT), +]; -$file = "/etc/ppp/chap-secrets"; -//$file = "./chap-secrets"; +// Create config.php if it doesn't exist +if (!file_exists('config.php')) { + file_put_contents('config.php', ' true]); + exit(); + } elseif (isset($_POST['changePassword'])) { + $newPassword = password_hash($_POST['newPassword'], PASSWORD_DEFAULT); + + // Read the config file + $config = include 'config.php'; + + // Update the password in the config file + $config['admin_password'] = $newPassword; + + // Write the updated config back to the file + file_put_contents('config.php', ' true]); exit(); } } ?> -
@@ -208,9 +246,31 @@ if ($_SERVER['REQUEST_METHOD'] === 'POST') { +