RE: [PHP] PHP and Cookies
> I have a problem with php and cookies. I use the following line of code > to set a cookie to expire in one year: > > setcookie('gsp_email',$_POST['requiredsubEmail'],time()*60*60*24*365 > ,'/','',0); > > The idea is that the cookie will sit on the client for a year, so that a > visitor only has to submit their email address once. > > However, when I close up all browser windows, then reload the browser (I'm > using IE 6), the cookie doesn't seem to 'stick'.. I'm once again asked for > my email address even though I already entered it and set the cookie. If you set your cookie settings to "prompt" do you receive the cookie? How are you checking for it later, to decide whether or not to prompt for an email? ---John W. Holmes... PHP Architect - A monthly magazine for PHP Professionals. Get your copy today. http://www.phparch.com/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] PHP and cookies and/or headers
Jeremy, I think there might be a JavaScript solution rather than a PHP solution to your problem. Depending on which link, either www.english.com or www.francais.com, the users click from www.mainurl.com you can set a cookie with JavaScript. Of course this cookie will 'remember' the user's initial language choice not the language of the page they finished on, but if the users don't swapping over and back between languages this shouldn't be a problem. Also as JavaScript is a client-side scripting language, which can be switched off, it is not 100% reliable but then neither are cookies! Paul Grant > -Original Message- > From: Jeremy Gillies [SMTP:[EMAIL PROTECTED]] > Sent: 15 February 2001 21:54 > To: '[EMAIL PROTECTED]' > 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: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > To contact the list administrators, e-mail: [EMAIL PROTECTED] The information contained in this e-mail is confidential, may be privileged and is intended only for the use of the recipient named above. If you are not the intended recipient or a representative of the intended recipient, you have received this e-mail in error and must not copy, use or disclose the contents of this email to anybody else. If you have received this e-mail in error, please notify the sender immediately by return e-mail and permanently delete the copy you received. This email has been swept for computer viruses. However, you should carry out your own virus checks. Registered in Ireland, No. 205721. http://www.FINEOS.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] PHP and cookies and/or headers
In your main page: 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 <[EMAIL PROTECTED]> 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: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > To contact the list administrators, e-mail: [EMAIL PROTECTED] > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] PHP and cookies and/or headers
Ive done this, our secure server is on a differnt IP/domain name, of course I still need cookies though. All I have todo to set the SessionID ona different domainname is pass the PHPSESSID in the url to the new host, and voila I have access to the same SessionID and other session vars. give it a shot, im sure this will work for you. if not please give me an email, I will help you. -- Chris Lee Mediawaveonline.com em. [EMAIL PROTECTED] ph. 250.377.1095 ph. 250.376.2690 fx. 250.554.1120 "Jeremy Gillies" <[EMAIL PROTECTED]> wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > 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: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > To contact the list administrators, e-mail: [EMAIL PROTECTED] > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]