how do I store a session in a cookie?
I'm needing to make a membership system
that uses cookies, and keeps the
user/password stored so when the user
returns, they are logged in.
Also, how would I "destroy" said cookie?
BTW, I've never used MD5() or any of
those before, so also I guess should
I use that ???? *confused* :dunce:you can right whatever you want to a cookie using setcookie().
setcookie ( string name [, string value [, int expire [, string path [, string domain [, int secure]]]]])
so basically... the name, whats in it, and how long it lasts.
you can retrieve the information with $_COOKIE['name'];
and to destroy a cookie, set a cookie with the same name but a negative time.okay,
you shouldn't store the password in a COOKIE....
you store some information (like a username) in the COOKIE, and the enxt time they visit your site, you take that COOKIE info and check against your database and start a SESSION...Okay, well how do I write and read a cookie?
I'm no good @ understanding the complex
sutff that PHP.net tosses @me set a cookie...
setcookie("cookiename", "cookievalue");
that cookie will expire when the browser is closed. if you dont want it to..
setcookie("cookiename", "cookievalue", time() + 3600);
to read from a cookie.
$variable = $_COOKIE['name'];
that will get what is in the cookie and store it in $variable.
I'm needing to make a membership system
that uses cookies, and keeps the
user/password stored so when the user
returns, they are logged in.
Also, how would I "destroy" said cookie?
BTW, I've never used MD5() or any of
those before, so also I guess should
I use that ???? *confused* :dunce:you can right whatever you want to a cookie using setcookie().
setcookie ( string name [, string value [, int expire [, string path [, string domain [, int secure]]]]])
so basically... the name, whats in it, and how long it lasts.
you can retrieve the information with $_COOKIE['name'];
and to destroy a cookie, set a cookie with the same name but a negative time.okay,
you shouldn't store the password in a COOKIE....
you store some information (like a username) in the COOKIE, and the enxt time they visit your site, you take that COOKIE info and check against your database and start a SESSION...Okay, well how do I write and read a cookie?
I'm no good @ understanding the complex
sutff that PHP.net tosses @me set a cookie...
setcookie("cookiename", "cookievalue");
that cookie will expire when the browser is closed. if you dont want it to..
setcookie("cookiename", "cookievalue", time() + 3600);
to read from a cookie.
$variable = $_COOKIE['name'];
that will get what is in the cookie and store it in $variable.