Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What happens if cookies are disabled?

Pretty basic question here. In PHP, if the user's browser has cookies disabled, you cannot make use of both server cookies ($_SESSION) AND client cookies ($_COOKIE, setcookie) or only the latter are disabled? Basically you can't make the user log in or do anything that requires a session, right?

Also, in which case would someone want to have cookies disabled?

Thanks!

like image 998
federico-t Avatar asked Mar 02 '12 06:03

federico-t


People also ask

What happen if we disable cookies?

Without your cookies, website hosts won't be able to count how many times you visit their sites, nor will they be able to create a digital persona based on your personal information. You may see fewer targeted ads as a result. However, the main appeal of deleting your cookies is that it gives you a clean slate.

Is it safe to disable cookies?

You definitely should not accept cookies – and delete them if you mistakenly do. Outdated cookies. If a website page has been updated, the cached data in cookies might conflict with the new site. This could give you trouble the next time you try to upload that page.

Should cookies be enabled or disabled?

Because so many web sites rely on cookies, I'd recommend leaving cookies turned on in your browser. They aren't a major security risk and they can make your web browsing much more efficient. You can change your cookie settings in your browser preferences under the "receiving files" heading.

What does it mean when cookies are disabled?

Your browser settings are such that the storing of cookies is currently disabled. In which case, simply enabling cookies and refreshing your screen should resolve your issue.


1 Answers

Yes, it's true. Both sessions and normal cookies are normal cookies. If a user does not accept cookies, he cannot use any of the functionality enabled by them. Which means pretty much the whole internet would break for that user, which is why in this day and age there's virtually nobody who has cookies disabled entirely.

PHP has a built-in mechanism called transparent session ids, which automagically rewrites all links to contain the session id in a query parameter. I would not suggest using it, since session ids in the URL open up a whole new can of worms.

For user friendliness, I'd recommend you test whether the user has cookies enabled or not (set a cookie, redirect to the next page with a flag in the URL that cookies should be set, see if you get any cookies back) and if not, kindly advise the user to enable them.

like image 84
deceze Avatar answered Oct 21 '22 18:10

deceze