hello
i am new to sessions, hope u guys could help
if i run this code for the first time. i will get error msg which is
UNDEFINED VARIABle for the $use and $password, so i check the sessions on
my temporary directory. i found that there is 2 sessions, onw containing
nothing and the other one contain the value of my $user and $password.so let
say we make the session A contains nothing and session B contains the value.
when run the file for first time the the session id on the url showed that is
session B but then the error msg appears. in order to make it show my value, i need to
go back to previous page and resubmit again.on this stage when i checked the sessions,
both the A and B sessions have the same value inside, its this the way how session works?,
why it doesn't show the value when it shows the correct session????
i tried using SID and PHPSESSID, both giving me the same problem and for your infomation my
track_vars and register_globals is on
the source code is given below.
<?
session_start();
global $user, $password;
if(!$user)
{
session_register("user", "password");
$session=session_id();
header("location:http://localhost/project/testing/dis1.php?$session");
}
else
{
session_register("user", "password");
$session=session_id();
header("location:http://localhost/project/testing/dis2.php?$session");
}
?>
//dis2.php
<?
session_start();
echo $user;
echo "<br>";
echo $password;
echo "TRUE";
?>
//dis1.php
<?
session_start();
echo $user;
echo "<br>";
echo $password;
echo "FALSE";
?>
and one more question, how do i set like after a period of time, i want the session to be remove
automatically?.does this got to do with gc_maxlifetime or gc_probability and how do i set it?
thanks