自定义HTML / PHP脚本简单

Is there a quick simple html or php script you can paste here that every IP adress that is in my website gets 1 point every 10 seconds?

In frequently called ajax request

$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");