|
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]
|