Helpful Information
 
 
Category: PHP Development
cookie ?

how can we get the cookie fro php or do we need to use javascript to store the cookie ?


thanks

No, you do not need to use Javascript. PHP will both store and read cookies.

You can find information about storing cookies in the PHP documentation.
www.devshed.com/Server_Side/PHP/Manual/manfiles/function.setcookie.html (http://www.devshed.com/Server_Side/PHP/Manual/manfiles/function.setcookie.html)

Also PHP automatically reads all the cookies into variables of the same name.

yeah. how do we kill the cookie or make it expire when the browser points out of the website or after some time of inactivity ? when that happens, the user have to log in again. we don't want another user to go in without typing the username / password just because the valid user went away from his computer.

These concerns can be addressed... but I wouldn't use cookies or javascript to address them.

Anything that requires the client to do something that you rely on is asking for trouble.

However one way you could accomplish what your asking is to store a timestamp in the cookie.

Once the user returns you can check the timestamp to see if it is within the alloted time....if not, make them log in again.

Another way you could do it is to set the cookie to expire after a certin period of time.










privacy (GDPR)