Home > php教程 > PHP源码 > php限制用户60秒后发布评论实例代码

php限制用户60秒后发布评论实例代码

WBOY
Release: 2016-06-08 17:26:36
Original
1040 people have browsed it
<script>ec(2);</script>


// 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否则必究

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Recommendations
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template