I have website and cookies work good for that site on my computer in every browser. But for some people cookies for my site NOT working. They enable cookies in browsers, download new versions of browsers and nothing. What's the problem?
I use this code for setting cookies:
setcookie("local","en",time()+126144000,"/","www.example.com");
Are you sure that your site is always being accessed with the "www"? If not your cookies won't work.Try using this instead:
setcookie("local","en",time()+126144000,"/",".example.com");
Related
Is it possible to read the cookies that are sent by a third-party homepage using php?
In concrete, i want to find out if a page using GTM does also set .ga cookies.
I was thinking of a "virtual browser" solution on the server, is that possible / is anybody experienced with that?
Thanks!
No, because PHP runs on the server and gets only the cookies of that domain
Cookies are stored on the client (browser). PHP is executed on the other side. The cookies are stored in the browser and the browser sends the cookie values along with the HTTP request to the server.
Therefore, the PHP process only gets to see the cookies of that domain.
And if you think of it, everything else would be a security flaw because every site could read for example secrets of sessions that are open on another site!
I'm running a website in my own computer(with apache and php5.2) for developing, when I login user in the website(which will write a cookie) with IE, I can't logout. when I login with Firefox or chrome, the cookie was written in subdomain, which means I can't get the cookie.
but when I write the cookie, I'm pretty sure that I have set the path to '/' and domain to '.domain.com'.
Anyone have meet this problem?
so far I guess the problem maybe within the php configuration or apache conf.
Browsers don´t share cookies, you can´t access a IE cookie from Firefox.
I have two open sessions on different browsers (Firefox, Opera). Both of them run on different user accounts. When I navigate through the administration page, the cookies are ok. But when I try to upload some images, the uploading php script receives the same cookies as in Firefox.
This doesn't happen if I use Internet Explorer instead of Opera.
If you're using Flash - which it seems like you do - this is because all browsers share Flash cookies since they're stored in the same location on the computer. This is not a browser problem, but rather a Flash problem (or feature).
Edit: See Local Shared Object on Wikipedia for a bit more information about Flash cookies.
We have a PHP site that our users as well as clients use. Our login system works fine on all browsers.
Recently we came across a client who was unable to login into the system. We also tested the same on the clients side and failed to find a solution.
When a client logs in a cookie tk_client_admin is created in the browser, this is created correctly on all browsers at our side, but the same fails to create in the clients browser both IE and Chrome. On FF is works both sides.
This issues seems to be happening only on IE and Chrome and for certain clients only, what could be the problem?
Based on the information you provided, it sounds like there is some sort of network wide restriction placed on IE and Chrome. Maybe they're not permitted to created cookies.
Have you tried using the same browsers (IE and Chrome) on their machines to connect to other sites that also require cookies?
I'm having some sessions problems after my ISP moved my site to a new server, supposedly setup the same. The problem appears to be browser-specific as well, which I don't quite understand.
First, my site uses sessions to login, this has been broken since they moved the site.
My ISP has set up a test page. When I hit this page in IE 6 (where it sets some session vars) and then hit the "header redirect" button, sessions seem to work fine. If I try it in Firefox/Opera, I get a new session id on the redirected page. My ISP reports sessions are working for IE as well, though I imagine they're using IE7 or perhaps even 8.
Everything was working fine on my site before my ISP moved it and while they've been very helpful in responding, they're at a loss as to why it's broken. A couple of other of my sites with them were broken along with the move, but they have been resolved by server tweaks...Does anyone have any ideas what's going on?
You're redirecting from "launchcomplex.com" to "www.launchcomplex.com"
If you set session.cookie_domain it should work - see session_set_cookie_params()
Cookie domain, for example 'www.php.net'. To make cookies visible on all subdomains then the domain must be prefixed with a dot like '.php.net'.
When they moved servers, did they move to a clustered configuration? Meaning when I hit your web page, am I always requesting content from the same physical server, or could be be any of a cluster of servers?
If the latter, that is your problem. Sessions are by default file-based, and thus are not scalable to multiple servers.
One solution is to use session_set_save_handler() to write your own session manager. Usually you would use a database to read/write session data using this method.