I have been wondering how can i use cookies to store and display last time the user has logged in to the system is this possible if so how will i go about it because i have no clue how to do any help will be great
@XeroSiSJun 19.2006 — #I think the best thing for you to do is have a cookie showing that the user is online or not (with a simple 0 and 1) ... you must set a timestamp for example 10 minutes if the person has no activity within the 10 minutes the cookie turns to 0 but if he does the timestamp refreshes! ... also everytime the person goes to a page it should check to see if the cookie is 0 or 1, if it is 0 turn it to 1 and make put the current time on the lastlogin cookie!
Did you understand a thing I said?! .. neither did I ?
[code=php] //put this at the very top of your php (inside the php tags of course) $time = date('l, F j, Y at g:i:s a') $y2k = mktime(11,59,59,12,31,2069); setcookie('lastlogin', $time, $y2k); [/code]
This makes a cookie with the last login time, in the format "Monday, January 1, 2006 at 9:30:15 am", in a cookie called "lastlogin" (that can be accessed easily with the variable $lastlogin) that will expire at 11:59:59 on December 31, 2069.
now, simply put
[code=php] "Last Login: $lastlogin" //where ever you want the login time [/code]