Advanced search  

News:

cpg1.5.48 Security release - upgrade mandatory!
The Coppermine development team is releasing a security update for Coppermine in order to counter a recently discovered vulnerability. It is important that all users who run version cpg1.5.46 or older update to this latest version as soon as possible.
[more]

Pages: [1]   Go Down

Author Topic: Picture since last visit  (Read 2431 times)

0 Members and 1 Guest are viewing this topic.

DaBe

  • Coppermine frequent poster
  • ***
  • Offline Offline
  • Posts: 110
Picture since last visit
« on: May 20, 2008, 07:45:45 pm »

hello

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?
Logged

just_some_guy

  • Supporter
  • Coppermine addict
  • ****
  • Offline Offline
  • Posts: 539
  • I am currently on holiday, back in a few weeks. :D
Re: Picture since last visit
« Reply #1 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 } ).
Logged
Tambien, Hablo Espaņol      PHP - Achieve Anything
"The Internet is becoming the town square for the global village of tomorrow. " - Bill Gates
Windows 7 Forums
Pages: [1]   Go Up
 

Page created in 0.018 seconds with 20 queries.