Preventing from time-out

Date 2005-08-12 12:06:37 | Category: XOOPS

in englishin japaneseSession time-out make the visitors very disappointed if he/she try to post long articles.

But lengthen 'session.gc_maxlifetime' is danger because of "SESSION HI-JACKING".

Thus, I've tried to implement the "Heart Beat" method into XOOPS.

Just "copy a file" and "edit theme.html".

It is quite an easy hack.

put this file as XOOPS_ROOT_PATH/heartbeat.php
heartbeat.php

<?php

include "mainfile.php";

$interval = @ini_get( 'session.gc_maxlifetime' ) ;
if( empty( $interval ) || $interval < 180 ) {
	$interval = 1440 - 120 ; // PHP default : 1440sec (=24min)
} else {
	$interval -= 120 ;
}

echo '
<html>
<head>
<meta HTTP-EQUIV="Refresh" CONTENT="'.$interval.'" />
</head>
<body>
</body>
</html>
' ;

?>



Edit theme.html and insert <frame> or <iframe> tags reading heartbeat.php

eg) end of theme.html

</td>
</tr>
</table>
<!-- end footer -->

<!-- heart beat -->
<{if $xoops_isuser }>
  <iframe src="<{$xoops_url}>/heartbeat.php" width="0" height="0"></iframe>
<{/if}>

</body>
</html>




You can read more news at PEAK XOOPS.
http://xoops.peak.ne.jp

The URL for this story is:
http://xoops.peak.ne.jp/md/news/index.php?page=article&storyid=66