1$_SESSION['previous'] = basename($_SERVER['PHP_SELF']);
2
3if (isset($_SESSION['previous'])) {
4 if (basename($_SERVER['PHP_SELF']) != $_SESSION['previous']) {
5 session_destroy();
6 ### or alternatively, you can use this for specific variables:
7 ### unset($_SESSION['varname']);
8 }
9}