You are here: Re: problem with sessions, please help! « All PHP « IT news, forums, messages
Re: problem with sessions, please help!

Posted by vdP on 10/13/52 11:34

jj wrote:
> Hi,
>
> I have a script that starts a session and registers a session variable as
> follows:
>
> ====================
> [login.php]
> ====================
> session_start();
> $_SESSION["userclass"]="admins";
> require('includes/application_top.php');
> ======================
>
> in the second file i simply check if the variable has been set or not:
>
> ======================
> [application_top.php]
> ====================
> if(!isset($_SESSION["userclass"]))
> {
> header("Location:login.php");
> exit;
> }
> ======================
>
>
> The problem is that no matter what my isset check always FAILS. Therefore
> always redirecting to the login.php page...Why is this? I checked the value
> of the "userclass" session variable and it has a value in it , but when i do
> my isset check (or any other check for that value) it always returns false
> therefore rendering the if statement which is not what i want.
>
> The other thing is if i take the snippet of code from the application_top
> file and put it together in just one file (in the login.php) it works
> perfectly fine. so the fact that i split the code into 2 seprete files
> seems to make the problem.. any advise appricated!
>

Do you use session_start() in the second script ?

vdP

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация