% ERuby.import('init.txt') forum_row = $db.query("SELECT * FROM forum_forums WHERE id=#{$cgi['forum']}").fetch_hash if $cgi.has_key? 'done' time = Time.new.to_i message = $db.quote($cgi['message'][0]) subject = $db.quote($cgi['title'][0]) $db.query("INSERT INTO forum_topics (forum_id, title, date_create, date_modified) VALUES (#{$cgi['forum']}, '#{subject}', #{time}, #{time})") topic_id = $db.insert_id $db.query("INSERT INTO forum_posts (forum_id, topic_id, date_create, message) VALUES (#{$cgi['forum']}, #{topic_id}, #{time}, '#{message}')") print $cgi.header("location" => "topic.eruby?id=#{topic_id}") exit end $navigation.add(forum_row['name'], "forum.eruby?id=#{$cgi['forum']}") $navigation.add("Add new topic", "newtopic.eruby") ERuby.import('head.txt') %>
<% ERuby.import('foot.txt') %>