0
votes

I m using PHP and framework is codeigniter. I have put iframe to display all data. when I click logout link, I cleared session value and redirect to login page. but when again if I press back button it shows me the previous frame contain. and some time It display nothing on frame after press back button of browser, but if I press refresh button then it will reinitialize session and work again. so pleas tell me ho to destroy session in codeIgniter so if user press back button he can not visit it.

1

1 Answers

0
votes

It is rather to browser cache than undestroyed session, so you have to send some headers to prevent caching the page while user is logged in:

header('Expires: '.date('r',time()-86400) ); // Date from the past
header('Cache-Control: no-store, no-cache, must-revalidate, post-check=0, pre-check=0');
header('Pragma: no-cache');

[+] And if you are using cookies as sessions identifiers in iframe, be aware that Internet Explorer neds additional header

header('P3P: CP="IDC DSP COR ADM DEVi TAIi PSA PSD IVAi IVDi CONi HIS OUR IND CNT"');

to set cookie from inside iframe.