= $maxrecords ) { $oldest_date = db_arr("SELECT `date` FROM `shoutbox` ORDER BY `date` ASC LIMIT 1"); db_res( "DELETE FROM `shoutbox` WHERE `date` = '{$oldest_date['date']}'" ); } // Select last class $last_class = db_arr("SELECT `class` FROM `shoutbox` ORDER BY `date` DESC LIMIT 1"); if ( ($cn = substr($last_class['class'], -1)) >= $classes ) $cn = $class_name . '1'; else $cn = $class_name . ($cn + 1); // Insert to database $query = "INSERT INTO `shoutbox` VALUES ('$id', '$text', NOW(), '$cn')"; db_res( $query ); } } echo " \n"; echo ThisPageMainCode(); echo " \n"; // --------------- page components functions /** * page code function */ function ThisPageMainCode() { global $site; global $maxtextlength; global $maxwordlength; global $tmpl; $content = "
"; $class = 'shoutbg1'; // Print input box $content .= " "; // End of print input box $query = "SELECT `shoutbox`.`id`, `shoutbox`.`text`, `shoutbox`.`date`, `shoutbox`.`class`, `Profiles`.`NickName` FROM `shoutbox` LEFT JOIN `Profiles` ON `Profiles`.`ID` = `shoutbox`.`id` ORDER BY `shoutbox`.`date` DESC"; $shout_res = db_res( $query ); while ( $shout_arr = mysql_fetch_array($shout_res) ) { $shout_text = process_smiles( process_line_output( $shout_arr['text'], $maxwordlength) ); $content .= " "; } $content .= "
"; if ($_COOKIE['memberID']) { if ($tmpl == 'g4') { $content .= "
" . _t('_shout_box_title') . "
"; } else { $content .= " "; } } else { $content .= _t('_to_post'); } $content .= "
{$shout_arr['NickName']}: {$shout_text}
\n"; return $content; } ?>