Jump to content

noob question: which one should I use?


kaiman

Recommended Posts

I am using the following lines of code to destroy user $_SESSIONS in PHP. However, after testing it in multiple browsers it seems to work fine in every browser but Safari (Win XP, Mac OS 10.5).

 

<?php
session_start();
$_SESSION = array();
session_unset();
session_destroy();
?>

 

Safari users can just use their back button to get back to the members area. So I was just reading about HTTP headers and came across the following examples. What is the best practice in this situation and which code should I use? Also what is the difference?

 

<?php
header("expires: Sun, 19 Nov 1978 05:00:00 GMT");
header("last-modified: " . gmdate("D, d M Y H:i:s") . " GMT");
header("cache-control: no-store, no-cache, must-revalidate");
header("cache-control: post-check=0, pre-check=0", FALSE);
?>

 

or

 

<?php
header("cache-control: no-store, no-cache, must-revalidate");
header("pragma: no-cache");
header("expires: 0");
?>

 

Thanks for the help  ;)

 

kaiman

Link to comment
https://forums.phpfreaks.com/topic/187766-noob-question-which-one-should-i-use/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.