この関数を呼ぶ度にクッキーでcountをインクリメントしていく関数
用法:
引数にそのページのid(string)を与えてあげる。
ex)get_countVisits('page274')
効能:
初めて来たかそうでないかを判断したいときなどに効く。
function get_countVisits($strId)
{
$life = 60 * 60 * 24 * 30 * 12;//* 約1年 本当はこうすべき:60 * 60 * 24 * 365
if(isset($_COOKIE["count".$strId])) {
$count = $_COOKIE["count".$strId] + 1;
}
else {
$count = 1;
}
setcookie("count".$strId, $count, time() + $life);
return $count;
}