Extend session time limit on deployed application

Hi guys,

This problem has frustrated me for a long time and I still can’t seem to figure it out completely.

I want to extend the php session timelimit on a deployed application to 8 hours so that people do not need to log in again during the workday.

Has anyone achieved this? No matter what I try with php variables, etc… I can’t seem to change it.

Thanks
Rob

You must to setup You php.ini with correct values for your sessions.
How You have your variables?

Hi Rob, In some hostings does not work modifying php.ini

I use this onApplicationInit of the menu

?>
<script>
	document.addEventListener("DOMContentLoaded", function(){
    // every 5 seconds ;)
    const miliseconds= 5 *1000;
    setInterval(function(){
        // We do not wait for the response of the request because we do not care
        fetch("../refresh/refresh.php");
    },miliseconds);
});
</script>	
<?php

create a blank app called refresh and paste this code

    ?>
    <html lang="en">
        <head>
            <meta charset="UTF-8">
            <meta name="viewport" content="width=device-width, initial-scale=1.0">
            <meta http-equiv="X-UA-Compatible" content="ie=edge">
            <title>Mi web</title>
        </head>
        <body>
            <p>Here the user can take whatever he wants, his session is not going to
close due to inactivity</p>
            <script>
                document.addEventListener("DOMContentLoaded", function(){
                    // We invoke every 5 seconds ;)
                    const miliseconds= 5 *1000;
                    setInterval(function(){
                        // We do not wait for the response of the request because we do not care
                        fetch("../refrescar/refrescar.php");
                    },miliseconds);
                });
            </script>
        </body>
    </html>
    <?php

Hope this can help you. Bye. Willy

2 Likes

Thanks Willy. It does seem that the host is overriding the ini file so this may be good workaround. Thanks.

I have just realised that the new security module in 9.6 includes a clientside cookie to allow session continuation. Thanks SC!

1 Like

🚀 Scriptcase 9.12 is now available! Check out the new features here 👉🚀 Next Monday (02/24), Scriptcase 9.12 will be released! Check out the new features before anyone else 👉