Perhaps the user doesn't have cookies disabled but often clean them? Another software could be doing that. -----Mensagem original----- De: Manuel Barros Reyes [mailto:manuca@xxxxxxxxx] Enviada em: segunda-feira, 25 de fevereiro de 2008 13:55 Para: php-general@xxxxxxxxxxxxx Assunto: Set PHP session expire to 2 months Hi, I'm working on a site that needs that once the user chooses his country the question should not be asked again (while the user doesn't manually delete the cookies in his browser). The question is asked only in the index.php and the answer is stored in $_SESSION["pais"]. If the user tries to enter the site once again and the session variable is still set the question is not asked again as it is supposed to happen. The session data is configured to last for aprox. 2 months and it works in the browsers I've tried it but still I receive reports of users who are constantly being asked for their countries they also told me they don't have cookies blocked. Below I paste the code I am using inside index.php to test if the session is set: <?php session_set_cookie_params(5184000); /* 2 Months */ session_start(); if(isset($_SESSION["pais"])) { header("Location: home.php"); } ?> Can someone see something wrong with this? Inside home.php I do the opposite if the session var. is not set the redirect to index.php. <?php session_set_cookie_params(5184000); /* 2 Months */ session_start(); if(!isset($_SESSION["pais"])) { header("Location: index.php"); } ?> Thanks in advance. Manuel -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php