php - Non caching page -


after 30 minutes user should logged out, seems cache keeping user online couple of pages/clicks...

if (isset($_session['last_activity']) && (time() - $_session['last_activity'] > 1800)) {     session_destroy();     session_unset(); }  $_session['last_activity'] = time();  // regenerates session id periodically avoid attacks on sessions if (!isset($_session['created'])) {     $_session['created'] = time(); } else if (time() - $_session['created'] > 1800) {     session_regenerate_id(true);      $_session['created'] = time(); }  $ts = gmdate("d, d m y h:i:s") . " gmt"; header("expires: $ts"); header("last-modified: $ts"); header("pragma: no-cache"); header("cache-control: no-cache, must-revalidate"); 

if (isset($_session['last_activity']) && (time() - $_session['last_activity'] > 1800)) {     session_destroy();     session_unset(); } 

this part seems have typo 1 of parenthesis after 1800 should instead in front of "greater than" sign:

if (isset($_session['last_activity']) && (time() - $_session['last_activity']) > 1800) {     session_destroy();     session_unset(); } 

Comments

Popular posts from this blog

Change php variable from jquery value using ajax (same page) -

Pull out data related to my apps from Android Play Store and iOS App Store -

How can I fetch data from a web server in an android application? -