0

Hi! I am having trouble in checking userlevel at the time of login. The pages set for admin level are not displayed if the user is not admin, but admin cant access the pages either!!:D Please solve my problem!
My code is:

<?php

if(!isset($_SESSION['userlevel']) || empty($_SESSION['userlevel']))
{
if ($_SESSION['userlevel'] == 2)
{
echo "ADMIN";
}
else
{
header('Location:index.php?query=notadmin');
}
}
?>
2
Contributors
2
Replies
3
Views
6 Years
Discussion Span
Last Post by anita_86
0

try this:

<?php

if(isset($_SESSION['userlevel']) || !empty($_SESSION['userlevel']))
{
if ($_SESSION['userlevel'] == 2)
{
echo "ADMIN";
}
else
{
header('Location:index.php?query=notadmin');
}
}
else
{
echo "session not exists..";
}
?>
0

You are right shanti.When I made the changes in code, I get message:

session not exists..

But it works fine with other levels.Dont know why its happening??

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.