A problem that exists when setting cookies is accessing the cookies on various urls such as: mydomain.com, http://mydomain.com and http://www.mydomain.com
Unfortunately, if you want a cookie(s) to be accessible on all directories in the domain regardless of what is inserted into the browser, you need to set the cookie properly.
But, if you want to access the cookie no matter how the url is presented in the browser, you would use:
setcookie(“my_cookie_name”, $var, time()+ 14400, ‘/’, ‘.mysite.com’);
The latter code above sets a cookie called my_cookie_name that remains usable for 2 hours. If you wanted to pull the data from the cookie it would actually be the value $var.
© 2018 ALL Rights Reserved | Sitemap
Vancouver | North Vancouver | Burnaby | Richmond | Coquitlam | Port Coquitlam | Surrey | Langley | Maple Ridge | Mission | Abbotsford | Kamloops | Kelowna | Victoria | Squamish | Whistler | Pemberton