On my social networking site I want to check how many messages and comments a user has sent in say a
10 minute time, if this number is greater then 10 I want to display a captcha, I have the captcha
code from other areas of the site so would like to implement the same code.
Would it be best to create a new table and everytime a message or comment is sent, update this table
with a users ID number and the datetime of the action, then check this new table before posting a new
message or comment, then daily like empty this table for size?
Below is my mail and comment table the most important thing is performance, need the best performance
code because my site is very high traffic.
MAIL TABLE
CREATE TABLE IF NOT EXISTS `friend_mail_details` (
`auto_id` int(11) NOT NULL auto_increment,
`to_user` int(10) NOT NULL default '0',
`from_user` int(10) NOT NULL default '0',
`subject` varchar(255) NOT NULL default '',
`message` text NOT NULL,
`status` enum('Read','Unread','Replied') NOT NULL default 'Read',
`date1` datetime NOT NULL default '0000-00-00 00:00:00',
`alert_message` enum('yes','no') NOT NULL default 'yes',
PRIMARY KEY (`auto_id`),
KEY `to_user` (`to_user`),
FULLTEXT KEY `message` (`message`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=300637 ;
COMMENTS TABLE
CREATE TABLE IF NOT EXISTS `friend_friend_comment` (
`autoid` int(11) NOT NULL auto_increment,
`userid` int(10) NOT NULL default '0',
`friendid` int(10) NOT NULL default '0',
`postdate` varchar(255) NOT NULL default '',
`status` enum('Active','In Active') NOT NULL default 'Active',
`body` text NOT NULL,
`alert_message` enum('yes','no') NOT NULL default 'yes',
`stausapprovrd` enum('Yes','No') NOT NULL default 'Yes',
PRIMARY KEY (`autoid`),
KEY `userid` (`userid`),
KEY `friendid` (`friendid`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=113338 ;