Hi dear list, I have session timeout set to 1 with while loop, it well keep looping until session expire, then it well run my script " file_put_contents('/tmp/phptest1234.txt', 'test');". Also I have javascript to keep pulling the script to keep it alive every interval time. If I close javascript page no more pulling the script then it well timeout and run my script " file_put_contents('/tmp/phptest1234.txt', 'test');" When I open javascript page it well call my php script and execute it along with " file_put_contents('/tmp/phptest1234.txt', 'test');". What I want here when I open javascript page it should keep pulling my php script. And if I close the page timeout well happen to my php script and execute my script " file_put_contents('/tmp/phptest1234.txt', 'test');" But this doesn't seems to work. How to accomplish this senior. Can somebody give help here please. Php code <?php session_start(); ?> <?php $_SESSION['timeout'] = time(); $st = $_SESSION['timeout'] + 1; while(time() < $st) { echo "$st\n"; } file_put_contents('/tmp/phptest1234.txt', 'test'); ?> Javascript code <script type="text/javascript" src="jquery-1.11.1.js"></script> <script type="text/javascript" > $(function(){ // set interval for 5 minutes setInterval(function(){ $.ajax({url: "test7.php" }); }, 10000); }); </script>
<<attachment: smime.p7s>>