if(empty($_SESSION['all_time'])) { $_SESSION['all_time'] = time(); } $_SESSION['all_time_end'] = time(); $total = ($_COOKIE['total']+$_SESSION['all_time_end'] - $_SESSION['all_time']); $_COOKIE['total']=$total; echo '['.$total.']';
<? if (условие если он ввышел в офф) { mysql_query("UPDATE `users` SET `segodnya`='$total' WHERE `id`='$usid'"); }
mysql_query("UPDATE `users` SET `segodnya`='$total' WHERE `id`='$usid'"); mysql_query("UPDATE `users` SET total=total+segodnya WHERE `id`='$usid'");
mysql_query("UPDATE `users` SET `segodnya`='$total', total=total+$total WHERE `id`='$usid'");