What are cookies for? i mean, for what can it be used? i know what they does but i don't see any useful use in them... in what you use cookies anon?
pd: i'm learning php, please don't be rude.
>>57964787
Storing client-side user preferences, such as language, region, etc. Very useful on sites that don't have accounts.
HTTP is stateless on the client-side, cookies provide client-side state.
How you use that is up to you: some use it to store session info, some use it to store local preferences, others use it for analytics.
>>57964878 like 4chan?
>>57964899
HTTP is a stateless protocol on both sides. One could argue that the fact that the server has a database which keeps information on the client's cookies means it has state, but really it's just a tacked on function. HTTP itself has no state.
>>57964913
Exactly.
>>57964899
Also this, which is why you generally don't want to allow cookies for anything but the 1st-party site.
>>57964946
State is described in HTTP a lot. For example, GET may not change state while POST may.
Or, a more simple approach: if HTTP was stateless, then repeating random HTTP requests would always result in the same (or at least a likewise) response, but this is not the case after, for example, a valid DELETE request.
>>57964787
spyng
>>57964787
> What are cookies for?
Sessions. Call:<?php session_start(); ?>
and then you will have the $_SESSION variable available to store persistent information across pages. It's implemented using cookies. Example:<?php session_start(); ?>
You have loaded a total of <?= ++$_SESSION["count"] ?> pages from this site so far.
>>57964878
>sites that don't have accounts.
lol, but anon, how do even sites WITH accounts store the 1 information saying that (YOU) are USERNo.57964878
yeah thats right, cookies, flashcookies, or "localstorage" which is just a fancy cookie only accessible via javascript instead (iirc) of sent via http headers
>inb4 IP-only matching or session enabled protocols
>>57965248
>>57965248
>GET may not change state
what about a FAGGOT http anon, can that change the thread state?
that state in the RFC is in the context of "server state", a PUT DELE or POST http request will generate the same result no matter which computer sent it, as long as all request headers are there, so thats stateless
>>57966265
>>57966265
>no matter which
and no matter if its the first communication sent to the http server, you didnt initiate a session to confirm credentials, the http just accepted your DELETE and passed it on to the backend,
>>57965286
/thread
don't let any other faggot shipost itt try to distract from teh troof.
>>57964787