hi,
i am making a website with php OOP.
i have a class called session:
it has the attribues
-logged_in;
-user_name;
-user_ip;
-user_level;
and two methods
-__construct
-starter()
-check_logged_in ()
ok
constructor calls:
session_start()
and sets:
-logged_in = check_session;
the starter, ... puts all the user information into $_SESSION array and then assigns that values to the user attributes: -user_name, -user_ip...
so when i call the object instance, constructor will determine if the user is logged in by calling -check_session which checks if:
$_SESSION[user_name] ... exist, if yes, it assigns its values to the attribues
and returns true, else returns false.
the point is that when i start the session by calling starter at one point of the script, and print_r($_SESSI ON) it will output all the user information which is normal.. this means the session has been correctly started.
BUT, when from the same part of the script, i redirect the user with header("locatio n:page.php")
page.php will call session->logged_in and it will return false....
is there a reason for that?
thnak you
bilibytes
i am making a website with php OOP.
i have a class called session:
it has the attribues
-logged_in;
-user_name;
-user_ip;
-user_level;
and two methods
-__construct
-starter()
-check_logged_in ()
ok
constructor calls:
session_start()
and sets:
-logged_in = check_session;
the starter, ... puts all the user information into $_SESSION array and then assigns that values to the user attributes: -user_name, -user_ip...
so when i call the object instance, constructor will determine if the user is logged in by calling -check_session which checks if:
$_SESSION[user_name] ... exist, if yes, it assigns its values to the attribues
and returns true, else returns false.
the point is that when i start the session by calling starter at one point of the script, and print_r($_SESSI ON) it will output all the user information which is normal.. this means the session has been correctly started.
BUT, when from the same part of the script, i redirect the user with header("locatio n:page.php")
page.php will call session->logged_in and it will return false....
is there a reason for that?
thnak you
bilibytes
Comment