<?php
$remind_refresh = 15 * 60000;
$now = (date("H")+$timezone)*60 + date("i",mktime());
$str_now =substr("0".(date("H")+$timezone). date("i",mktime()),-4);
$result = db_query("select event,anfang,ende from ".$DB['current'].".termine where an = '$user_ID' and datum = '$datum' and anfang >= '$str_now' order by anfang");
while ($row = db_fetch_row($result)) {
$text = html_out(substr($row[0],0,16));
if (strlen($row[0]) > 16) { $text = $text."..";} //string has more than 10 characters? cut and insert '...'
$mess = $mess."$row[1]-$row[2]: $text<br><hr>\n";
$begin = substr($row[1],0,2)*60+substr($row[1],2,2);
$now = (date("H")+$timezone)*60 + date("i",mktime());
if ( ($begin <= ($now+$remind_freq)) and ($begin > $now)) {
$a = $begin - $now;
$mess2 = "$row[0] $rem_text1 $a $rem_text2";
$b = 1;
}
}
if (!$mess) { $mess = "$rem_text3.<br><hr>"; }
echo "$mess";
?>