Support => cpg1.4.x Support => Older/other versions => cpg1.4 modpack by Stramm => Topic started by: DaBe on May 20, 2008, 07:45:45 pm

Title: Picture since last visit
Post by: DaBe on May 20, 2008, 07:45:45 pm

How I can display the last picture since the last visit. like in a forum the last post since the last visit?

I want that display in the in the infobox after the login with LOGIN_FORM from the modpack.

is that possible?
Title: Re: Picture since last visit
Post by: just_some_guy on May 20, 2008, 09:09:51 pm
You would need to compare the users last logout time with the time you uploaded the file; in {prefix)_pictures table, the upload time is recorded as "ctime" and the last login time is stored in the database. But, you would need to add a new column to the users database to register the time the user logged out, and only update this when logout is clicked. You cant use the user_lastvisit column for this as this is updated when the user logs in, this way the lastvist time will always be greater than the time the last file was uploaded as lastvisit is updated before you have a chance to see if any new files have been added, by making a new column and storing the logout time you can check for new files and only update the logout time when logout is actioned.

Then you could calculate whether any new files were added by comparing the new logout column with ctime from the pictures table. Note. to make life easier you should enter the logout times into the database in the same time format as ctime is stored as (which i think is a 16 figure TIMESTAMP). That way it would make the calculation easier (a simple if (logout_time < ctime) { //show information } ).