I want to add a timestamp for the "last seen" field in the user database but i have to read a cookie to get a user name.
How can i read the username from the cookie and add a time stamp for the username in the cookie?
Table name is users and and field name is "lastseen"
thanks a lot!
simple question
Moderator: General Moderators
I'm sorry. This isn't very secure. I also use time() for the timestamp because I like the integer for allowing me to display the time how I want using the date() function.
Or if the mysql type is of TIMESTAMP and you can't use time(), then do this instead.
Code: Select all
mysql_query("UPDATE users
SET lastseen=". time() ."
WHERE username='". mysql_escape_string($_COOKIE['username']) ."'");Code: Select all
mysql_query("UPDATE users
SET lastseen=CURRENT_TIMESTAMP()
WHERE username='". mysql_escape_string($_COOKIE['username']) ."'");