What are the potential risks of using scripts to artificially extend session times on banking websites?
Using scripts to artificially extend session times on banking websites can pose significant security risks, as it allows unauthorized access to sensitive user information and transactions. This can lead to fraudulent activities, identity theft, and financial loss for both the users and the bank. To mitigate this risk, it is important to enforce strict session timeout policies and implement proper authentication mechanisms to ensure the security of user sessions.
// Set session timeout to 15 minutes
ini_set('session.gc_maxlifetime', 900);
session_start();
// Check if session is active and redirect to login page if not
if (isset($_SESSION['LAST_ACTIVITY']) && (time() - $_SESSION['LAST_ACTIVITY'] > 900)) {
session_unset();
session_destroy();
header("Location: login.php");
exit;
}
// Update last activity time on each page load
$_SESSION['LAST_ACTIVITY'] = time();