I have two different session IDs ('reg_gen' & 'assess') for the same user to log in to different parts of the web site (containing several pages) with different passwords.
I use the following code in the two php include file to switch between sessions(and website areas):
php include file 1
This works fine when I switch from one id to other without leaving the browser.
When I close the browser and try to access a page in the same area of the web site as previously (with the same phpinlude file) I am not asked to login.
I tried adding:
at the very beginning of each code above, but this time as I go from one page to other (with the same include file), each time I am asked to log in again.
How can I destroy the previous session when leaving the browser, but only need to log in once on the first page instance of the same site area?
I use the following code in the two php include file to switch between sessions(and website areas):
php include file 1
Code:
<?php
session_id('reg-gen');
session_start();
session_destroy();
session_id('assess');
session_set_cookie_params(0);
session_start();
and the rest of the code ................
AND php include file 2
<?php
session_id('assess');
session_start();
session_destroy();
session_id('reg-gen');
session_set_cookie_params(0);
session_start();
rest of the code..............................
When I close the browser and try to access a page in the same area of the web site as previously (with the same phpinlude file) I am not asked to login.
I tried adding:
Code:
session_start(); session_destroy();
How can I destroy the previous session when leaving the browser, but only need to log in once on the first page instance of the same site area?