if(($_COOKIE['splash']) != ""){ //redirect // header("location:index2.php"); } if(($_COOKIE['splash']) == ""){ //create a new cookie with a new cartid $random_number = "been here"; setcookie("splash",$random_number, time()+31536000,"/"); /* Expires in a year */ //setcookie ("cookie1", "$val1", time()+3600, "/"); } ?>