$LiveTimeCookie = $_COOKIE["LT"];$time = time();$LiveTimeCookie <= $time+600;if (!setcookie("LT",$LiveTimeCookie,0,$site,FALSE,TRUE)) { exit ("<BR> Не установлено печенье!"); };echo "<BR>cookie: ".$LiveTimeCookie;echo '<BR>time: '.time();print_r($_COOKIE);
<?php $cookie = "А вот и кука. <a href='?delet=1'>Удалить</a>"; $test = "Нет куки. <a href='?install=1'>Поставить</a>"; if(isset($_GET['delet'])) { setcookie("test", "", time()-3600*24 ); header("location: ".$_SERVER['PHP_SELF']); } elseif(isset($_GET['install'])) { setcookie("test", $cookie, time()+3600*24*30); header("location: ".$_SERVER['PHP_SELF']); } $test = isset($_COOKIE['test'])?$_COOKIE['test']:$test; echo $test;