Re: PHP and cookies and/or headers

From: Date: Fri, 16 Feb 2001 13:57:23 +0000
Subject: Re: PHP and cookies and/or headers
Groups: php.general 
Request: Send a blank email to php-general+get-40141@lists.php.net to get a copy of this message
On your splash page, instead of having it send the user directly to either the english or french site, first have it send to another page on that domain along with a variable to tell it whether it's english or french. For example, the English button would be linked to "setcookie.php?Language=English" and the French button would be linked to "setcookie.php?Language=Francais". On the setcookie.php page, use an if statement to determine which language they chose, then inside of it set the cookie then redirect them to the language site of their choice. For example: <? if($Language=="English"){ setcookie("Language", "$Language"); header("location: http://www.english.com"); }else{ setcookie("Language", "$Language"); header("location: http://www.francais.com"); } ?> Then on your home page, you would have it check for these cookies: <? if($Language=="English"){ header("location: http://www.english.com"); }elseif($Language=="Francais"){ header("location: http://www.francais.com"); }else{ show_the_choice_page(); } ?> I think this would be the best solution. Let me know if anybody comes up with anything better. -Angela -- Angela Curtis Internet Programmer Innovative Business Consultants http://www.ibc2001.com

« previous php.general (#40141) next »