Danke ... habs inzwischen über eine "Timeout" Funktion gelöst

Markus
Code: Alles auswählen
##############################################################
## MOD Title: Timeout Mod
## MOD Author: itst < sc@itst.org > (Sascha Carlin) http://www.itst.org/
## MOD Description: This mods allows guests to surf the forums for a predefined time.
## After this time runs out (a little countdown is shown in the header)
## they must either login or register. All other attempts to access the
## forums are redirected to a info page.
##
## All setting are done via constants.php. The text for the info page is
## set via lang_main.php.
## You don't need to use the shipped timeout.php. You can use any file
## you want, even a file outside phpBB.
##
## MOD Version: 0.1
##
## Installation Level: Easy
## Installation Time: 5 Minutes
## Files To Edit:
## includes/constants.php
## includes/page_header.php
## includes/sessions.php
## language/*/lang_main.php
## templates/*/overall_header.tpl
##
## Included Files: timeout.php
##############################################################
## For Security Purposes, Please Check: http://www.phpbb.com/mods/ for the
## latest version of this MOD. Downloading this MOD from other sites could cause malicious code
## to enter into your phpBB Forum. As such, phpBB will not offer support for MOD's not offered
## in our MOD-Database, located at: http://www.phpbb.com/mods/
##############################################################
## Author Notes:
## If you use more than one language/template, you will want to change all your
## lang_main.php and overall_header.tpl files.
##
##############################################################
## MOD History:
##
## 2004-03-22 - Version 0.1
## INITIAL RELEASE
##
##############################################################
## Before Adding This MOD To Your Forum, You Should Back Up All Files Related To This MOD
##############################################################
#
#-----[ OPEN ]------------------------------------------
#
includes/constants.php
#
#-----[ FIND ]------------------------------------------
#
define('PAGE_GROUPCP', -11);
#
#-----[ AFTER, ADD ]------------------------------------------
#
define('TIMEOUT_PAGE', -99);
#
#-----[ FIND ]------------------------------------------
#
?>
#
#-----[ BEFORE, ADD ]------------------------------------------
#
//
//Timeout Mod
//
// 10 minutes * 60 seconds = 600 seconds
define('TIMEOUT_SECONDS', 600);
// After 15 minutes all requests will be forwared to this page
define('TIMEOUT_FORWARD', 'timeout.' . $phpEx);
// Whether to show the timeout countdown.
define('TIMEOUT_SHOWCOUNTDOWN', TRUE);
#
#-----[ OPEN ]------------------------------------------
#
includes/page_header.php
#
#-----[ FIND ]------------------------------------------
#
//
// Login box?
//
#
#-----[ BEFORE, ADD ]------------------------------------------
#
if (TIMEOUT_SHOWCOUNTDOWN && ($userdata['timeout_countdown'] <> ''))
{
$template->assign_block_vars('switch_timeout_countdown', array());
$template->assign_vars(array(
'TIMEOUT_COUNTDOWN' => sprintf($lang['Timeout_Countdown'], $userdata['timeout_countdown']))
);
}
#
#-----[ OPEN ]------------------------------------------
#
includes/sessions.php
#
#-----[ FIND ]------------------------------------------
#
//
// Do not check IP assuming equivalence, if IPv4 we'll check only first 24
// bits ... I've been told (by vHiker) this should alleviate problems with
// load balanced et al proxies while retaining some reliance on IP security.
//
#
#-----[ BEFORE, ADD ]------------------------------------------
#
if ($userdata['user_id'] == ANONYMOUS)
{
if (($thispage_id == TIMEOUT_PAGE) || ($thispage_id == PAGE_LOGIN) || ($thispage_id == PAGE_REGISTER) || ($thispage_id == PAGE_PROFILE))
{
$page_id = FALSE;
} else
{
$page_id = TRUE;
}
if (($userdata['session_start'] < ($current_time - TIMEOUT_SECONDS)) && $page_id)
{
redirect(append_sid(TIMEOUT_FORWARD, true));
} else
{
$userdata['timeout_countdown'] = @date("i:s", $userdata['session_start'] - ($current_time - TIMEOUT_SECONDS));
}
}
#
#-----[ OPEN ]------------------------------------------
#
languages/*/lang_main.php
#
#-----[ FIND ]------------------------------------------
#
//
// That's all, Folks!
#
#-----[ BEFORE, ADD ]------------------------------------------
#
//Timeout Mod
$lang['Timeout_Message'] = '<b>Your session expired.</b><br /><br />After %d minutes you must either <a href="%s">login</a> or <a href="%s">register</a> to continue browsing these forums.';
$lang['Timeout_Countdown'] = '%s to go.';
#
#-----[ OPEN ]------------------------------------------
#
templates/*/overall_header.tpl
#
#-----[ FIND ]------------------------------------------
#
<tr>
<td><a href="{U_INDEX}"><img src="templates/subSilver/images/logo_phpBB.gif" border="0" alt="{L_INDEX}" vspace="1" /></a></td>
#
#-----[ BEFORE, ADD ]------------------------------------------
#
<!-- BEGIN switch_timeout_countdown -->
<tr>
<td align="right" colspan="2"><span class="gensmall">{TIMEOUT_COUNTDOWN}</span></td>
</tr>
<!-- END switch_timeout_countdown -->
#
#-----[ SAVE/CLOSE ALL FILES ]------------------------------------------
#
# EoM