Dear experties,
I have a problem with windows back key. It's still able to click when session expired and go to previous page. How can I disable that key?? Means user cannot go to the previous page? Anybody can help me?
Here my session expired script :-

<?php
session_start();
 $timeout = 900;

 if(isset($_SESSION['timeout'])) {
    $duration = time() - (int)$_SESSION['timeout'];
     if($duration > $timeout) {
     session_destroy();
          echo "<script language='javascript'>alert('Sorry!! Your session expired! Please login to start new session. Thank you.');window.location='index.php';</script>";
          exit;
     }
  }
          $_SESSION['timeout'] = time();
?>

I think you should add $_SESSION['timeout'] = time(); inside if(isset($_SESSION['timeout'])) {condition.

Once your session expires and you are redirected back to index.php again you will have $_SESSION['timeout'] set with time(); So you can redirect back anywhere.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.