I am developing game and I need to show to player, how much day he is under protection. This is what I have for now:
if(user::loged()){
$protect = (60*60*24*8) - (time() - user::info['reg_date']);
$left = date("n",$protect);
if($left > 0) echo "You are protected for $left days!";
}
For first (test) user reg_date
is 1394883070 (15.3.2014 11:31). So it should print
You are protected for 7 days!
But I get that
You are protected for 1 days!
Any ideas?