I have index.php in my project, then the error showed up while accessing the login page:
Notice: Undefined index: session_user_start in E:\laragon\www\virtualsacc\index.php on line 51
Short snippet of index.php that might relate to the error:
if (($login_user == $db_user || $login_user == $db_email) && $login_password == $db_pass){
if ($db_accstatus == "ACTIVE"){
session_start();
$_SESSION['session_user_start'] = 1;
$_SESSION['session_user_username'] = $db_user;
$_SESSION['session_user_email'] = $db_email;
$_SESSION['session_user_id'] = $db_id;
$_SESSION['session_user_name'] = $db_name;
header('location:banking');
} else {
header('location:?disabled=1');
}
} else {
header('location:?error=1');
}
}
?>
<?php
session_start();
if ($_SESSION['session_user_start'] == "1"){
header('location:banking');
}
?>
And it's line 51 of index.php:
if ($_SESSION['session_user_start'] == "1"){
What's wrong with my code? Can someone explain and help me why isn't it working?