I am busy on a protected page with login and I want know if there is more protection needed. It is a very simple system without database etc...
authentication.php
<?php
session_start();
if($_SERVER['REQUEST_METHOD'] == 'POST'){
$account = array (
'sebas' => '$2y$10$96Yi1ezzoS6xZYjPhbvYTeCha.YypKF.7MSYwfruXtKaFyeGRLeMK',
'bert' => '$3g$10$96Yi1ezzoS6xZYjPhbvYTeCha.YypKF.7MSYwfruXtKaFyeGRLeMK',
);
if(array_key_exists($_POST['user'], $account)){
if(password_verify($_POST['password'], $account[$_POST['user']])){
session_regenerate_id();
$_SESSION['username'] = $_POST["user"];
$_SESSION["loggedin"]) = true;
header("location: protected_page.php");
}else{
echo 'Something wrong';
}
}else{
echo 'Something wrong';
}
}
?>
protected.php
<?php
session_start();
if (isset($_SESSION['loggedin']) && $_SESSION['loggedin'] == true) {
echo 'welcome';
}else{
header("location: login.php");
exit;
}
?>
Please let me know and give me any feedback for a better secure system without database.