Moderator: Supporter
// Birthday Mod, Show users with birthday
// -- add mod : B-day Caching to show users with birthday on Index / Portal -------------------
$cache_bday_file = $phpbb_root_path . "cache/bday/bday_" . $board_config['board_timezone'] . ".php";
$time_now = time(); // if already present you should remove this line
if ( @file_exists($cache_bday_file) )
{
$last_update_time = @filemtime($cache_bday_file);
$newest_regdate = $newest_userdata['user_regdate'];
if (!isset($newest_userdata['user_regdate']) || $newest_regdate == 0)
{
$sql = "SELECT user_regdate FROM " . USERS_TABLE . "
WHERE user_id <> " . ANONYMOUS . " AND user_active = 1
ORDER BY user_id DESC LIMIT 0,1";
if (!$result = $db->sql_query($sql))
{
message_die(GENERAL_ERROR, 'Could not obtain regdate information', '', __LINE__, __FILE__, $sql);
}
while ($row = $db->sql_fetchrow($result))
{
$newest_regdate = $row['user_regdate'];
}
$db->sql_freeresult($result);
}
$valid = ( ((date('Yz',$time_now) - date('Yz',$last_update_time)) == 0) && (($time_now - $newest_regdate) > ($time_now - $last_update_time)) ) ? true : false;
} else {
$valid = false;
}
$session_id = ( isset($HTTP_GET_VARS['sid']) ) ? $HTTP_GET_VARS['sid'] : '';
if ($valid && $session_id=='')
{
include ($cache_bday_file);
$birthday_today_list = stripslashes($birthday_today_list);
$birthday_week_list = stripslashes($birthday_week_list);
} else {
$sql = ($board_config['birthday_check_day']) ? "SELECT user_id, username, user_birthday, user_level FROM " . USERS_TABLE. " WHERE user_birthday <> 999999 AND user_active=1 ORDER BY username" : "";
if($result = $db->sql_query($sql))
{
if (!empty($result))
{
$this_year = create_date('Y', $time_now, $board_config['board_timezone']);
$date_today = create_date('Ymd', $time_now, $board_config['board_timezone']);
$date_forward = create_date('Ymd', $time_now+($board_config['birthday_check_day']*86400), $board_config['board_timezone']);
while ($birthdayrow = $db->sql_fetchrow($result))
{
$user_birthday2 = $this_year.($user_birthday = realdate("md",$birthdayrow['user_birthday'] ));
if ( $user_birthday2 < $date_today ) $user_birthday2 += 10000;
if ( $user_birthday2 > $date_today && $user_birthday2 <= $date_forward )
{
// user are having birthday within the next days
$user_age = ( $this_year.$user_birthday < $date_today ) ? $this_year - realdate ('Y',$birthdayrow['user_birthday'])+1 : $this_year- realdate ('Y',$birthdayrow['user_birthday']);
// $birthdayrow['username'] = color_group_colorize_name($birthdayrow['user_id']);
if ( $userdata['session_logged_in'] )
{
$birthdayrow['username'] = color_group_colorize_name($birthdayrow['user_id']);
$birthday_week_list .= ' ' . $birthdayrow['username'] . ' ('.$user_age.'),';
}
else
{
$birthdayrow['username'] = color_group_colorize_name($birthdayrow['user_id'],TRUE);
$birthday_week_list .= ' ' . $birthdayrow['username'] . ' ('.$user_age.'),';
}
} else if ( $user_birthday2 == $date_today )
{
//user have birthday today
$user_age = $this_year - realdate ( 'Y',$birthdayrow['user_birthday'] );
if ( $userdata['session_logged_in'] )
{
$birthdayrow['username'] = color_group_colorize_name($birthdayrow['user_id']);
$birthday_today_list .= ' ' . $birthdayrow['username'] . ' ('.$user_age.'),';
}
else
{
$birthdayrow['username'] = color_group_colorize_name($birthdayrow['user_id'],TRUE);
$birthday_today_list .= ' ' . $birthdayrow['username'] . ' ('.$user_age.'),';
}}
}
if ($birthday_today_list) $birthday_today_list[ strlen( $birthday_today_list)-1] = ' ';
if ($birthday_week_list) $birthday_week_list[ strlen( $birthday_week_list)-1] = ' ';
}
$db->sql_freeresult($result);
if ($session_id=='')
{
if ($fp = fopen($cache_bday_file, "w"))
{
// stores the data set in a cache file
$bday = "<?php\n";
$bday .='$birthday_today_list = \'' . addslashes($birthday_today_list) . "';\n";
$bday .='$birthday_week_list = \'' . addslashes($birthday_week_list) . "';\n?>";
fwrite($fp, $bday);
fclose($fp);
@chmod($cache_bday_file, 0777);
}
}
}
}
// -- fin : B-day Caching ---------------------------------------------------------------------
Sorry, aber diese Frage geht mir allmählich Tierisch auf den S...!Wo finde ich den den zugefügt Hack wie er hier drin ist!
Hast recht. Denkfehler meinerseits.Hmm also bei mir haben Gäste keine SID, was zur folge hat das nach wie vor das gecachte file genommen wird. Also verstehe ich nicht, wie das mehr belasten sollte?
Mitglieder in diesem Forum: 0 Mitglieder und 1 Gast