是否可以在此处粘贴一个简单的html或php脚本,使我网站上的每个IP地址每10秒获得1分?
答案 0 :(得分:0)
在经常调用的ajax请求中
$current = time();
if (isset($_COOKIE["time_last"]))
if ($current - $_COOKIE["time_last"] > 10) // time to points
if ($current - $_COOKIE["time_last"] < 300) //No away
{
$points = @file_get_contents(__DIR__."/points.txt"); //current point
file_put_contents(__DIR__."/points.txt",$points+1); // save new
}
setcookie("time_last",time()); // Add time stamp to browser
print "Points: ".file_get_contents(__DIR__."/points.txt");