Hi,
I have encountered a problem when switching from http to https. The issue only occurs for certain people trying to use the HTTPS. Maybe one in 25 people. Its definetly something that happens when it changes from http to https because were i change in the site from http to https the problem shows up. Its not the code as the code has worked fine for a year before the http to https.
It seems to lose the cookie created. I have a cookie/ $_Session which is lost when changing from http to https. The strange thing is that its not a issue i can replicate with testing so it could be something to do with peoples browser settings in not tesing with? Im not sure.. Things installed: PHP MYSQL CURL SSL says its supports most browsers
Would appreciate any advice/experiences you have had on this subject. Thanks
Could it be that the domain is accessed without a subdomain (e.g. http://yoursite.com) but when the redirection takes place, it's redirected with a 'www' subdomain (e.g. https://www.yoursite.com) ?
If so, and unless you specified '.yoursite.com' as the domain for the cookie, that would most likely be the problem.
Hi There,
Thank you very much for the reply.
so would i use the setcookie like the following?
setcookie("TestCookie", $value, time()+3600, ".example.com", 1);
so that it would work for http and https?
Well, you're missing the path parameter (after expire), which you most likely want to set to '/'. In addition, I'd think that you would want to leave the secure parameter as FALSE so that the cookie would be sent for both the HTTP and HTTPS protocols.
Thanks for that!!!!!!! its worked well..
Also i have noticed that the $_SESSION parameters have been affected before. Is there anything i can do for that?
For example i have been losing the $_SESSION when changing from http to https?
is there anything to prevent this?
Many Thanks
Well if that resolved your cookie issue, then you'll likely need to do the same for the session cookie using [man]session_set_cookie_params/man.