PEAK XOOPS - Preventing from time-out in englishin japanese

Archive | RSS |
XOOPS
XOOPS : Preventing from time-out
Poster : GIJOE on 2005-08-12 12:06:37 (113978 reads)

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>

Printer friendly page Send this story to a friend

Comments list

Rollei  Posted on 2006/4/9 15:39
GIJOEさん、こんにちは。
そういえば、このコメントしていました。返事をいただけなかったので、勝手に、カスタマイズするを「はい」にして時間を短縮して今日に至っていました。半年遅れのお返事ありがとうございます。早速、「いいえ」に修正しました
GIJOE  Posted on 2006/4/6 3:59
今頃気づきました。(半年以上?)

一般設定の「セッション」の時間は、ほとんどの場合気にしなくて良いと思います。というのも、セッションをカスタマイズする事の方がよほど問題だからです。

セッションをカスタマイズする、については、「いいえ」が、推奨です。ブラウザを閉じてもセッションそのものが生きているのですから、いろんな意味で危険です。

必要なら、「セッションカスタマイズ」せずに、php.iniなり、.htaccessなりで、session.maxlifetimeを調整することになるでしょう。
Rollei  Posted on 2005/9/23 12:39
こんにちは、rolleiです。
ハックを試してみました。たしかにタイムアウトしなくなりました。そこでお聞きしたいのですが、一般設定の「セッション」の時間は何分にすればいいのでしょう? デフォルトはたしか15分だったと思いますが、もっと短く、たとえば5分とかにしておく方がベターなのでしょうか?
Rollei  Posted on 2005/9/6 1:32
待っていました!という気持ちです。
早速使ってみます。
GIJOE  Posted on 2005/8/28 16:13
Prolonging session by "heart beat" and "autologin" are quite different each other.

If you want to test it, try to delete all records in the session table by phpMyAdmin or mysql command.
greywolf  Posted on 2005/8/26 23:49
Sorry, if this sounds stupid, but does the autologin hack not also prolong the session ?
indream  Posted on 2005/8/19 23:53
testing
Bahattee  Posted on 2005/8/15 9:46
Very cool! Thanks!
Login
Username or e-mail:

Password:

Remember Me

Lost Password?

Register now!