// php教程限制用户60秒后发布评论实例代码
/*
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教程_connect('localhost','root','root') or die('mysql server 2001');
mysql_select_db('test',$conn);
$date = time();
$ip = $_server['remote_addr'];//获取ip地址,这是测试所以没作判断了
$wait = "select times,ip from abc where ip='$ip' and ($date-times
$rows = mysql_query($wait ) or die( mysql_error());
if( mysql_num_rows( $rows ) )
{
die('坐下来休息一下吧,您的动作太快了,请60秒后再发布你的信息!');
}
else
{
$sql = "insert into abc(times,ip) values('$date','$ip')";
$insert = mysql_db_query('test',$sql,$conn);
if( $insert )
{
echo '评论成功';
}
else
{
echo '评论失败';
}
}
}
?>
本站原创文章转载注明来源于www.111cn.net否则必究

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

Video Face Swap
Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

SublimeText3 English version
Recommended: Win version, supports code prompts!

mPDF
mPDF is a PHP library that can generate PDF files from UTF-8 encoded HTML. The original author, Ian Back, wrote mPDF to output PDF files "on the fly" from his website and handle different languages. It is slower than original scripts like HTML2FPDF and produces larger files when using Unicode fonts, but supports CSS styles etc. and has a lot of enhancements. Supports almost all languages, including RTL (Arabic and Hebrew) and CJK (Chinese, Japanese and Korean). Supports nested block-level elements (such as P, DIV),

Dreamweaver CS6
Visual web development tools

PhpStorm Mac version
The latest (2018.2.1) professional PHP integrated development tool

VSCode Windows 64-bit Download
A free and powerful IDE editor launched by Microsoft
