Thread: cookie ?

    #1
  1. No Profile Picture
    kingsley
    Guest
    Devshed Newbie (0 - 499 posts)
    how can we get the cookie fro php or do we need to use javascript to store the cookie ?


    thanks
  2. #2
  3. No Profile Picture
    moderator
    Guest
    Devshed Newbie (0 - 499 posts)
    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

    Also PHP automatically reads all the cookies into variables of the same name.
  4. #3
  5. No Profile Picture
    kingsley
    Guest
    Devshed Newbie (0 - 499 posts)
    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.

  6. #4
  7. No Profile Picture
    rod k
    Guest
    Devshed Newbie (0 - 499 posts)
    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.
  8. #5
  9. No Profile Picture
    moderator
    Guest
    Devshed Newbie (0 - 499 posts)
    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.

Similar Threads

  1. Placing user-entered data into cookie
    By Tyrone in forum Perl Programming
    Replies: 2
    Last Post: February 17th, 2004, 04:31 PM
  2. ASPSESSIONID cookie seems to kill JavaScript cookie
    By cdarling in forum JavaScript Development
    Replies: 1
    Last Post: July 25th, 2003, 12:25 PM
  3. javascript - cookie based redirect... not working?
    By drgroove in forum JavaScript Development
    Replies: 4
    Last Post: July 4th, 2003, 01:55 AM
  4. can't get cookie from different directory
    By manjoufna in forum Perl Programming
    Replies: 2
    Last Post: April 9th, 2003, 04:11 PM
  5. Per session cookie expiration
    By csaba in forum PHP Development
    Replies: 4
    Last Post: June 21st, 2002, 09:54 PM

IMN logo majestic logo threadwatch logo seochat tools logo