ob_start(); $foo = file('online/licznik.txt'); $ex = @explode('|', $foo[0]); if(!isset($_COOKIE['licz_x'])) { ((date('n') == @$ex[2])) ? $ex[3]++ : $ex[3] = 1; $ex[2] = date('n'); ((date('d') == @$ex[0])) ? $ex[1]++ : $ex[1] = 1; $ex[0] = date('d'); } if(!isset($_COOKIE['licz_xO'])) { (empty($ex[4])) ? $ex[4] = 1 : $ex[4]++; } $write = fopen('online/licznik.txt', 'w'); flock($write, LOCK_EX); fwrite($write, join('|',$ex)); flock($write, LOCK_UN); fclose($write); $hours = date('G'); $minutes = date('i'); $hoursleft = 23 - $hours; $minutesleft = 59 - $minutes; $hs = $hoursleft * 3600; $ms = $minutesleft * 60; $timeleft = $hs + $ms; if(!isset($_COOKIE['licz_x']) || !isset($_COOKIE['licz_x0'])) { setcookie('licz_x','x',time()+$timeleft); setcookie('licz_xO','x',time()+$timeleft); } ob_end_flush(); ?>