Hi everyone.
I am using session authorisation in a php website I am developing.
The sessions are being stored fine in the global variable $_SESSION[‘authorisation’] which is why I am a bit stumped.
I get the correct output from my echo statements below.
When it echos “Logged in user” the Notice: Undefined index lines do not appear, only when the user is not logged in they appear.
Can anyone help me?
Please find the errors and code I am using below.
Notice: Undefined index: authorisation in C:\xampp\htdocs\Scorer\matches.php on line 42
Notice: Undefined index: authorisation in C:\xampp\htdocs\Scorer\matches.php on line 44
[php]session_start();
if ($_SESSION[‘authorisation’] == ‘knownuser’){ <----- Line 42
echo “
Logged in user
”;} elseif ($_SESSION[‘authorisation’] != ‘knownuser’) { <----- Line 44
echo “
Not logged in user
”;}[/php]