Re: PHP and cookies and/or headers

From: Date: Fri, 16 Feb 2001 01:39:36 +0000
Subject: Re: PHP and cookies and/or headers
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-40053@lists.php.net to get a copy of this message
In your main page: <?php if (strstr($HTTP_REFERER, 'www.english.com')){ header("Location: www.english.com"); } elseif (strstr($HTTP_REFERER, 'www.francais.com')){ header("Location: www.francais.com"); } ?> Note: I usually swap the needle/haystack and have to look them up, but you probably won't just use strstr anyway, so I didn't. -- Visit the Zend Store at http://www.zend.com/store/ Wanna help me out? Like Music? Buy a CD: http://l-i-e.com/artists.htm Volunteer a little time: http://chatmusic.com/volunteer.htm ----- Original Message ----- From: Jeremy Gillies <jgillies@cupw-sttp.org> Newsgroups: php.general Sent: Thursday, February 15, 2001 4:00 PM Subject: [PHP] PHP and cookies and/or headers > Greetings, > > Is anyone REALLY familiar with PHP and cookies and/or headers-- I have a > tough nut to crack and it involves three URLs. > > Here is the situation, and I really want to avoid using our DB if I can. > > I have a main URL that everyone will probably hit - splash page. > www.mainurl.com > > From there, users go into either the french or english version of the site > with two unique URLs... > > www.english.com > www.francais.com > > I want it so that if users go back to the splash page, it will pick up their > language preference (french or english) and send them to the index page of > either www.english.com or www.francais.com -- depending upon the last > argument set when they were last at the site. So, if they ended on an > english page, they would start at the english index page, but if the > finished on a french page, they would start on the french index page. > > The problem with cookies is the fixed URL from which they can be read. > Obviously www.mainurl.com cannot read a cookie set by www.francais.com -- so > how can I over come this. > > I suppose I could do it via IP stored in a DB, but even then there is a > problem as people who hide behind one IP -- say a large business -- > would be stuck using each others' preferences depending upon who used the > site last. > > I also do not want the user to have to type in a code word so that the > IP is tagged with a special identifier. I suppose I could use a random > number generated from a time stamp... but I really want to avoid using a DB! > -- mostly for speed and bloat of page size reasons. > > Thanks in advance! > Jeremy > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net > For additional commands, e-mail: php-general-help@lists.php.net > To contact the list administrators, e-mail: php-list-admin@lists.php.net >

« previous php.general (#40053) next »