Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

[PHP] Re: PHP and cookies and/or headers

3 views
Skip to first unread message

Angela

unread,
Feb 16, 2001, 9:21:18 AM2/16/01
to
After reading through the setcookie page on php.net, I found out that for some reason it
won't let you redirect to a different site after setting the cookie. So, as a fix, change
the headers on the setcookie.php page to redirect to the index page, and let the index
page take care of the redirecting.
-Angela

-------- Original Message --------
Subject: Re: PHP and cookies and/or headers
Date: Fri, 16 Feb 2001 08:57:23 -0500
From: Angela <ang...@localnetamerica.com>
To: Jeremy Gillies <jgil...@cupw-sttp.org>,php-g...@lists.php.net

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

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: php-general...@lists.php.net
For additional commands, e-mail: php-gene...@lists.php.net
To contact the list administrators, e-mail: php-lis...@lists.php.net

Angela

unread,
Feb 16, 2001, 8:55:39 AM2/16/01
to

Angela

unread,
Feb 16, 2001, 4:35:04 PM2/16/01
to
When they click on the tab to change languages, you could have that go back to a page on
the main site, reset the cookie, and then send it on to the site you want it to go to.
-Angela

Jeremy Gillies wrote:
>
> angela,
>
> this would work if people did not switch back and forth between langauges.
> We have many bilingual users who want print copies, for example, in french
> and english. Each time they click a little tab at the top, it will switch
> languages and sites too, BUT will remain with the corresponding text in the
> other language.
>
> thank you for your help so far,
> jeremy


>
> > -----Original Message-----
> > From: Angela [mailto:ang...@localnetamerica.com]
> > Sent: Friday, February 16, 2001 8:57 AM
> > To: Jeremy Gillies; php-g...@lists.php.net
> > Subject: Re: PHP and cookies and/or headers
> >
> >

0 new messages