Forum Moderators: coopster
Are there any one know solution for this problem.
Thank you
I am not quite understanding the scenario
>> show the included page for one or tow seconds and after that logs out
do you mean it logs out on the next click?
or is there some type of refresh on the page?
are do you mean if they reload that same page?
are you using session_start at the top of every page?
first it seems to be some type of refresh as you said Mr. jatar_k and also i am using session_start at the top of every page.
Mr. ergophobe i am not understand your question about default handler but it is allways log out after fixed period of about few seconds i think tow.
and i had notice that in my localhost windows PC the code work properly but in my linux server it dosnt.
best regards
and sorry if my english is not good.
no need to apologize for things like that
hmmm, can you maybe see if the session is actually getting set properly?
this is your test
if (@$_SESSION[level'] == 'ok')
remove the @ from there and maybe try echo'ing that value on each page to make sure it is being set
echo '<p>level: ',$_SESSION[level'];
if ($_SESSION[level'] == 'ok')
then see if the value is correct
Given your answers, my question wasn't relevant, so you can forget about it for now anyway.
In the same light as Jatar_K's session test, check also that $id is getting set.
Also, get rid of the @ in this statement
switch(@$id)
Perhaps the include problem is because $id is getting unset? PHP would treat this as $id = 0, which would fail both of your switch criteria.
Try putting this at the top of your script, but after the session_start() command:
if (!isset($id)) {
echo '$id is undefined';
}
if (!isset($_SESSION))
{
echo 'session is not set';
}
This will at least let you know what's going on.
>> you could try absolute paths instead of ../../
>> so from the / of your website
i was tried both methods first one by my website it produce errors like this :
Warning: main(): URL file-access is disabled in the server configuration ...Warning: ... mainfailed to open stream: no suitable wrapper could be found ...
Warning: main(): Failed opening ...for inclusion (include_path='.:/usr/share/pear')
and second by the absolute / path and its work but same problem was occured.
the point what i want to refer that i had using relative path like ../../ a lot of times in my code and my include pages work properly and this code with same file names work properly in my localhost.
ergophobe.
>> Perhaps the include problem is because $id is getting unset? PHP would treat this as $id = 0, which would fail both of your switch criteria.
i have already check to $id at the top of my code like this :
if ((@$_SESSION['User_Level']!= '3') ¦¦ empty($id))
{
Logout("../myrep/");
exit();
}
so that the $id and $_SESSION are tested.
I think that php include another page that contains validation to level rather than 3 and logout immediatly when it make a validation.