做点赞的时候为什么加个每天只能点赞一次的代码,就不行啊。
<br />@$love=$_POST['id'];<br /><br />if(isset($love)){<br /> $query="SELECT * FROM ecs_article_love where article_id='$love' AND ip='$realip'";<br /> $result=mysql_query($query);<br /> $row=mysql_fetch_row($result);<br /> //dump($row);<br /> $ip1=$row[2];<br /> $ip2=$realip;<br /> <br /> $todaytime=strtotime(date('Y-m-d'));<br /> $iptime=$row[3];<br /> //$endtime=strtotime(date('Y-m-d',strtotime('+1 day')));<br /> //echo $todaytime;<br /> <br /> if(strcmp($ip1,$ip2)==0){<br /> echo 2;<br /> }<br /> if(!$row && $iptime<$todaytime){<br /> $query="INSERT INTO ecs_article_love (ip,article_id,iptime) VALUES ('".$ip2."','".$love."','".$todaytime."')";<br /> mysql_query($query);<br /> //echo "<script>alert('点赞成功')</script>";<br /> $sql = $GLOBALS['db']->query("update ".$GLOBALS['ecs']->table('article')." set love=love+1 where article_id=$love");<br /> echo 1;<br /> } <br /> <br /> <br /> die();<br />}<br />