Added (Check Duplicates Before Adding New User)

master
Abanoub Hany 2024-07-01 20:41:20 +03:00
parent 6339774759
commit 139af13643
3 changed files with 15 additions and 11 deletions

12
header.php 100644
View File

@ -0,0 +1,12 @@
<?php
// Define default config values
$defaultConfig = [
'chap_secrets_path' => '/etc/ppp/chap-secrets',
'admin_username' => 'admin',
'admin_password' => password_hash('change@me', PASSWORD_DEFAULT),
];
// Create config.php if it doesn't exist
if (!file_exists('config.php')) {
file_put_contents('config.php', '<?php return ' . var_export($defaultConfig, true) . ';');
}

View File

@ -1,16 +1,6 @@
<?php <?php
include 'header.php';
session_start(); session_start();
// Define default config values
$defaultConfig = [
'chap_secrets_path' => '/etc/ppp/chap-secrets',
'admin_username' => 'admin',
'admin_password' => password_hash('change@me', PASSWORD_DEFAULT),
];
// Create config.php if it doesn't exist
if (!file_exists('config.php')) {
file_put_contents('config.php', '<?php return ' . var_export($defaultConfig, true) . ';');
}
if (!isset($_SESSION['loggedin']) || $_SESSION['loggedin'] !== true) { if (!isset($_SESSION['loggedin']) || $_SESSION['loggedin'] !== true) {
header('Location: login.php'); header('Location: login.php');

View File

@ -1,4 +1,6 @@
<?php <?php
include 'header.php';
session_start(); session_start();
if ($_SERVER['REQUEST_METHOD'] === 'POST') { if ($_SERVER['REQUEST_METHOD'] === 'POST') {