[PHP] FW: Cookies, Dammit!
Is there a way to: 1. Set cookies to a particular value (e.g., foo=hi and bar=ho), AND 2. Redirect the user to a new page in a different directory? AND 3. have the new page be able to retrieve the values of both foo and bar? I'm redirecting users from an index.htm page to an index.php page (because our server is not set up to have index.php as a default page), and trying to set cookies on the index.php page prior to redirecting the user to an index.htm page in an entirely different directory (why? because for some reason I thought it would streamline one of our processes). However, the cookies simply don't get set; a document.write command on the second index.html page shows that the value of the cookies is null. The value of the cookies are determined by the results of a query run against a MySQL directory, so they cannot be set on the first index.html page. I have been struggling with this conundrum for three days at this point, with no success. Let me know if this doesn't make sense. -- 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] FW: Cookies, Dammit!
1.Set cookies to a particular value (e.g., foo=hi and bar=ho), AND 2.Redirect the user to a new page in a different directory? AND 3.have the new page be able to retrieve the values of both foo and bar? No, 1. and 2. can not be done in the same request reliably. Some browsers can handle it, others can't. -Rasmus -- 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] FW: Cookies, Dammit!
In this case, the value of the cookie is pulled from a database; the specific value depends on the URL at the user is redirecting from. If the user comes from www.domain.com/minisite1/index.htm then when they're directed to www.domain.com/index.htm, they should see "Welcome from minisite1"; but if they come from www.domain.com/minisite2/index.htm they should see "Welcome from minisite2" when they're redirected to www.domain.com/index.htm. it's a bit more complicated than that, but that's the general idea. Hope that helps. -- Richard S. Crawford Senior Web Developer NeuroHub, Inc. (916)789-4167 / (530)307-0069(cell) AIM Handle: Buffalo2K http://www.neurohub.net -Original Message- From: Jason Brooke [mailto:[EMAIL PROTECTED]] Sent: Tuesday, January 16, 2001 2:48 PM To: [EMAIL PROTECTED] Subject: Re: [PHP] FW: Cookies, Dammit! The thing that usually intrigues me is why people design their application so that it needs to redirect to another page just so that they can attempt to read the cookie back. Do they not already have the value of the cookie in order to be able to set it? Why attempt to read it back straight away? jason Some browsers just can't handle a redirect and a set-cookie header in the same request. How you get PHP to generate these headers is irrelevant. -Rasmus -- 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] FW: Cookies, Dammit!
The first approach is actually what we do now. However, since /index.htm is a dynamic page which changes frequently, we don't want to have to try to echo all of those changes into all of the /minisite directories (of which there are well over 100) every single time a change occurs. We're going to try the second approach now, but we still are going to try to build the query string of the Location: header based on values retrieved from a MySQL database. -- Richard S. Crawford Senior Web Developer NeuroHub, Inc. (916)789-4167 / (530)307-0069(cell) AIM Handle: Buffalo2K http://www.neurohub.net -Original Message- From: Jason Brooke [mailto:[EMAIL PROTECTED]] Sent: Tuesday, January 16, 2001 3:10 PM To: Richard S. Crawford Cc: [EMAIL PROTECTED] Subject: Re: [PHP] FW: Cookies, Dammit! Any reason you don't include the contents of /index.htm into /ministe1/index.htm with the appropriate welcome message instead of redirecting, or even pass the site name in the query string of the Location: URL if you're not wanting to rely on http_referer? jason In this case, the value of the cookie is pulled from a database; the specific value depends on the URL at the user is redirecting from. If the user comes from www.domain.com/minisite1/index.htm then when they're directed to www.domain.com/index.htm, they should see "Welcome from minisite1"; but if they come from www.domain.com/minisite2/index.htm they should see "Welcome from minisite2" when they're redirected to www.domain.com/index.htm. it's a bit more complicated than that, but that's the general idea. Hope that helps. -- Richard S. Crawford Senior Web Developer NeuroHub, Inc. (916)789-4167 / (530)307-0069(cell) AIM Handle: Buffalo2K http://www.neurohub.net -- 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] FW: Cookies, Dammit!
I hope you don't mind me nagging on this ;) but what do you mean by having to echo changes into the /minisite directories? What I meant was, from minisite45/index.htm, include() the same content include file you use in /index.htm. I'm not seeing why the /minisitex/index.htm pages need to change at all? The only thing that would change is the content of the include()'d file that /index.htm, and the minisite/indexx.htm include. /index.htm html etc etc body... ? include "main_include.inc"; ? /body /html main_include.inc: some possible html tags ? echo "Welcome". ($minisite ? " from $minisite" : "."); ? some possible html tags /minisite45/index.htm html stuff ? $minisite = 45; /* or even a snip that dynamically gets it from the script_name */ include "main_include.inc"; ? - Original Message - From: "Richard S. Crawford" [EMAIL PROTECTED] To: "Jason Brooke" [EMAIL PROTECTED]; "Richard S. Crawford" [EMAIL PROTECTED] Cc: [EMAIL PROTECTED] Sent: Wednesday, January 17, 2001 9:19 AM Subject: RE: [PHP] FW: Cookies, Dammit! The first approach is actually what we do now. However, since /index.htm is a dynamic page which changes frequently, we don't want to have to try to echo all of those changes into all of the /minisite directories (of which there are well over 100) every single time a change occurs. We're going to try the second approach now, but we still are going to try to build the query string of the Location: header based on values retrieved from a MySQL database. -- Richard S. Crawford Senior Web Developer NeuroHub, Inc. (916)789-4167 / (530)307-0069(cell) AIM Handle: Buffalo2K http://www.neurohub.net -- 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] FW: Cookies, Dammit!
The problem is that the main page doesn't use an include file of any sort; it's straight HTML which is frequently updated by hand. I agree that it would be nice if /index.htm had an include file that contained most of the content, and if I could convince my boss that it would be the best way to go, then I'd be set. :) Unfortunately, that's not the route that we've chosen to go (in fact, I'm still at the stage where I'm trying to convince people around here that PHP is a much better way to go than straight HTML for some of these documents). So, if I were using an include file to build /index.htm, then I would use it in microsite45/index.htm. But since I'm not, I can't. I've got permission to use document.write in /index.htm, so I was looking for a solution which would allow /index.htm to remain nothhing but static HTML (with the exception of some JavaScript). -Original Message- From: Jason Brooke [mailto:[EMAIL PROTECTED]] Sent: Tuesday, January 16, 2001 3:37 PM To: Richard S. Crawford Cc: [EMAIL PROTECTED] Subject: Re: [PHP] FW: Cookies, Dammit! I hope you don't mind me nagging on this ;) but what do you mean by having to echo changes into the /minisite directories? What I meant was, from minisite45/index.htm, include() the same content include file you use in /index.htm. I'm not seeing why the /minisitex/index.htm pages need to change at all? The only thing that would change is the content of the include()'d file that /index.htm, and the minisite/indexx.htm include. /index.htm html etc etc body... ? include "main_include.inc"; ? /body /html main_include.inc: some possible html tags ? echo "Welcome". ($minisite ? " from $minisite" : "."); ? some possible html tags /minisite45/index.htm html stuff ? $minisite = 45; /* or even a snip that dynamically gets it from the script_name */ include "main_include.inc"; ? - Original Message - From: "Richard S. Crawford" [EMAIL PROTECTED] To: "Jason Brooke" [EMAIL PROTECTED]; "Richard S. Crawford" [EMAIL PROTECTED] Cc: [EMAIL PROTECTED] Sent: Wednesday, January 17, 2001 9:19 AM Subject: RE: [PHP] FW: Cookies, Dammit! The first approach is actually what we do now. However, since /index.htm is a dynamic page which changes frequently, we don't want to have to try to echo all of those changes into all of the /minisite directories (of which there are well over 100) every single time a change occurs. We're going to try the second approach now, but we still are going to try to build the query string of the Location: header based on values retrieved from a MySQL database. -- Richard S. Crawford Senior Web Developer NeuroHub, Inc. (916)789-4167 / (530)307-0069(cell) AIM Handle: Buffalo2K http://www.neurohub.net -- 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] FW: Cookies, Dammit!
With due respect to your boss, PHP would make the site *more* compatible with people's browsers, without having to worry about which version(s) of javascript people have, or in fact if they even have it available. I'd pitch the accessibility angle, in your shoes, if nothing else. Good luck. "Richard S. Crawford" wrote: The problem is that the main page doesn't use an include file of any sort; it's straight HTML which is frequently updated by hand. I agree that it would be nice if /index.htm had an include file that contained most of the content, and if I could convince my boss that it would be the best way to go, then I'd be set. :) Unfortunately, that's not the route that we've chosen to go (in fact, I'm still at the stage where I'm trying to convince people around here that PHP is a much better way to go than straight HTML for some of these documents). So, if I were using an include file to build /index.htm, then I would use it in microsite45/index.htm. But since I'm not, I can't. I've got permission to use document.write in /index.htm, so I was looking for a solution which would allow /index.htm to remain nothhing but static HTML (with the exception of some JavaScript). -- 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]