.htaccess - PHP sessions in HTACCESS - timeout -
i'm debugging infinite loop problem in php in "logout" routine.
if($_session) { session_unset(); session_destroy(); } sleep(1); header('7location: http://accounts.domain.com/'); exit;
in main / initial.inc.php script have :-
$sess=0; $sess=$_session['loggedin']; foreach($_session $asw => $asd) { $logrep.="sessw '$asw' '$asd'\n"; } if($sess>0) { if($sess<$ty) { $logrep.="is timed out - logging out\n"; header('location: http://accounts.domain.com/logout/'); exit;
theres bit more code i've taken out - in 'logout' script ive got destroy / unset etc -
but when redirects inward script, sessions still exist ? - & determines i'm timed out, & redirects logout routine.
query: there fool-proof way remove / eliminate sessions ?
query :-
$previous_name = session_name("name"); session_save_path("$directory"); session_start();
is there php.ini line can use, replace session_name all/any php scripts using same name ? (just in case there scripts not using named session.)
edit :-
if use
session_unset(); session_destroy();
will destroy all sessions ? or currently-named 1 ? (i suspect of scripts aren't using named session)
ps - scripts in different directories / subdomains.
edit 2 :-
ive chanmged script :-
$sess=0; $logrep.="sess '$sess'\n"; $logrep.=var_dump( $sess=$_session['loggedin']); $logrep.="sessnow2 - '$sess'\n\n\n"; $text.="logged in time $sess\n"; $logrep.="\nsess = $sess\n"; $temp2=time(); $temp1=($sess-$temp2); $logrep.="iff sess $sess > time $time - temp $temp1\n"; if($sess>0) { - redirect log out routine ....
(some code removed)
result :-
old sess - '1391680203' sess '0' sessnow2 - '1391680203'
apparently, sessions not being deleted / removed.
i guess file 'initial.inc.php' included in top of every scripts.
on logged out page, have :
session_unset(); session_destroy();
at stage, session destroyed.
header('location: http://accounts.domain.com/');
which executes 'initial.inc.php';
i assume have @ start of initial.inc.php 'session_start();, because have
$sess=$_session['loggedin'];
and doesn't seems throws warning because of session being missing. session re-created in initial.inc.php file.
Comments
Post a Comment