Hi, im am using 1.39h and al lot off customizations.
Every thing works just fine. Recently i have decided to use Jquery instead off Mootools and have made some customizing on the site with some ajax scripts: autocomplete, slide, pagination ...
As i said everything works.
The problem is with session timeouts, only when a customer is logged in. When a logged in customer stays on the same page for more then 24 minutes, the session times out, and he makes a ajax reguest on this page for any off the scripts i have he gets: a blank page for the autocomplete script and a "new whole site" instead of the div for pagination or slide, so practicly the customer gets a blank page or a new web page on the same page.
I have also installed "Automatic login" wich works just fine, but i still get the same errors when a customers is logged in, session times out and he makes a Ajax reguest
In all my Ajax scripts i use at the start
and at the endPHP Code:require('includes/application_top.php');
My solution: the Refresh plugin from Jquery, and this is the code:PHP Code:require(DIR_WS_INCLUDES . 'application_bottom.php');
Do not try this on a live site, your site structure might be different from mine, this is just an example
1. load jquery, something like this
<script type="text/javascript" src="includes/templates/YOUR_TEMPLATE/jscript/jquery_min.js"></script>
2. in templates/YOUR_TEMPLATE/commom/tpl_header.php
this script calls for the page refresh_jason.php every 23 minutes if the customers in logged in and is not on any checkout page.PHP Code:<?php
$page_refresh= false;
// don't display on checkout page:
if (substr($current_page, 0, 8) != 'checkout') {
$page_refresh= true;
}
if ($_SESSION['customer_id'] && $page_refresh == true) {
?>
<script type="text/javascript">
// you can set a page refresh before dom ready
$.refresh('refresh_json.php', 1380*1000);
</script>
<?php }
in this way i keep the session alive until the browser closes or the customer logs out.
3. the code in refresh_jason is simple, just to load application_top.php and application_bottom.php
If anybody has a better solution or an advice please let me know.PHP Code:<?php
require('includes/application_top.php');
?>
{
"value":1
}
<?php
require(DIR_WS_INCLUDES . 'application_bottom.php');
?>
I dont know if this is the best way to do it, but for the moment it works for me.
I am opened to suggestions.
Best regards, Zoli
Merry Christmas to everyone !!!



