Jump to content

[SOLVED] Not detecting my session correctly


9three

Recommended Posts

<?php

session::Start();
//session::setSession('member', 1);
//session::setSession('USER_AGENT', $_SERVER['HTTP_USER_AGENT']);
//session::Authenticate(index);
?>
<html>
<head>
<title></title>
</head>
<body>
<?php
foreach ($_SESSION as $field => $level)
{
  if (isset($field) && $level == 1)
    echo 'Tester Session';
  elseif (isset($field) && $level == 2)
    echo 'Agent session';
  else
    echo 'No session detected';
}
?>
</body>
</html>

 

I grayed out the area so I could get my else statement to echo out 'No session detected', but it's not working.

I tried doing some of the follow

 

//Attempt 1
elseif (!isset($field))
  echo 'No session detected';

//Attemp 2, I also tried $field == '' || $value == ''
elseif ($field == NULL || $level == NULL)
  echo ''No session detected';

 

Anyone know what I'm doing wrong?

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.