Ec (2); & lt ;? The php tutorial limits the user to publish the comment instance Code * createtable 'test' 60 seconds later '. 'abc' ('id' int (4) notnullauto_increment, 'times 'int (4) notnulldefault0, 'IP' varchar (200) nulldefaultnull, primary script ec (2 ); script
// Php tutorial limits the user to publish the comments instance code 60 seconds later
/*
Create table 'test'. 'abc '(
'Id' int (4) not null auto_increment,
'Times 'int (4) not null default '0 ',
'IP' varchar (200) null default null,
Primary key ('id ')
) Engine = myisam
*/
If ($ _ post)
{
$ Conn = mysql tutorial _ connect ('localhost', 'root', 'root') or die ('mysql server 2001 ');
Mysql_select_db ('test', $ conn );
$ Date = time ();
$ Ip = $ _ server ['remote _ addr ']; // obtain the ip address. This is a test, so no judgment is made.
$ Wait = "select times, ip from abc where ip = '$ ip' and ($ date-times <60) order by id desc limit 1 ";
$ Rows = mysql_query ($ wait) or die (mysql_error ());
If (mysql_num_rows ($ rows ))
{
Die ('Sit down and have a rest. Your actions are too fast. Please release your information 60 seconds later! ');
}
Else
{
$ SQL = "insert into abc (times, ip) values ('$ date',' $ ip ')";
$ Insert = mysql_db_query ('test', $ SQL, $ conn );
If ($ insert)
{
Echo 'comment successful ';
}
Else
{
Echo 'comment failed ';
}
}
}
?>
Original article reprinted on this site indicated that the source is www.111cn.net, otherwise it must be investigated