Cookies - fresh rolls
Job with kuki from PHP is facilitated up to impossibility. All that is required to you, it only to learn{find out} some functions. And then you can ship your users in their world and in many respects to facilitate their life on your site.
So, the first that to you should be taught{learnt}, it how to put kuki to the user.
Completely anything complex , use function setcookie (). Its{her} general{common} format.
<? php
int setcookie (string name [, string value [, int expire [, string path [, string domain [, int secure]]]]])
?>
So we should specify a name kuki and its{her} value. Other fields are not obligatory are time of a life kuki (before which date), on what directory we put, on what domain and whether safety kuki (it is used seldom) is necessary.
Example.
<? php
setcookie ("TestCookie", " Ded Mozor ");
/* And these kuki live only one hour */
setcookie ("TestCookie", $value, time () +3600);
/* Only for a directory user a site *phpdevs.com */
setcookie ("TestCookie", $value, time () +3600, "/user / ", ".phpdevs.com", 1);
?>
For removal{distance} kuki simply put empty value.
<? php
setcookie ("TestCookie", " ");
?>
Now we read kuki.
<? php
$my_cookie = $HTTP_COOKIE_VARS ["TestCookie"];
?>
As you can see all is very simple up to a disgrace.

|