Advanced search  

News:

CPG Release 1.6.26
Correct PHP8.2 issues with user and language managers.
Additional fixes for PHP 8.2
Correct PHP8 error with SMF 2.0 bridge.
Correct IPTC supplimental category parsing.
Download and info HERE

Pages: [1]   Go Down

Author Topic: Limit uploads per day  (Read 7563 times)

0 Members and 1 Guest are viewing this topic.

ThunderRed

  • Coppermine newbie
  • Offline Offline
  • Posts: 15
Limit uploads per day
« on: June 27, 2010, 05:47:14 pm »

Hi everyone,

First I hope I'm writing this in the correct place, if isn't, I'm really sorry.

I have been searching in the forum for a possible hack/mod to limit the uploads to the users per day. They only thing I found was this:
http://forum.coppermine-gallery.net/index.php/topic,15874.0.html

Which was for the version 1.3.x and it doesn't work with the 1.5.x (I already tried).

The problems is, that, I would like to upgrade the website that we have, and switch the gallery to Coppermine, but in order to do that, I have to limit the uploads per day, since we have more than 9.000 user, and it will be crazy if all of them can upload all of what they want. The quota limit doesn't really work for us, since (if I understood this well, the quota doesn't have a time limitation, and maybe a single user could use the whole quota).

What I would like is to check if it possible, to just limit how many pictures the users can upload every day.

Thank you so much.
Logged

Αndré

  • Administrator
  • Coppermine addict
  • *****
  • Country: de
  • Offline Offline
  • Gender: Male
  • Posts: 15764
Re: Limit uploads per day
« Reply #1 on: June 27, 2010, 08:05:15 pm »

What happens if you apply that mod? It should basically work, but you have to consider the different upload methods (flash uploader, simple upload, plugins). Which upload method did you use while testing?
Logged

Joachim Müller

  • Dev Team member
  • Coppermine addict
  • ****
  • Offline Offline
  • Gender: Male
  • Posts: 47843
  • aka "GauGau"
    • gaugau.de
Re: Limit uploads per day
« Reply #2 on: June 28, 2010, 07:47:35 am »

Logged

ThunderRed

  • Coppermine newbie
  • Offline Offline
  • Posts: 15
Re: Limit uploads per day
« Reply #3 on: June 28, 2010, 11:13:10 am »

What happens if you apply that mod? It should basically work, but you have to consider the different upload methods (flash uploader, simple upload, plugins). Which upload method did you use while testing?

I get an error. Can't recognize the "db_query"

Board rules / Forum policies: Post Links

Sorry, I didn't think you need to see the gallery, since it wasn't anything wrong with it.

This is the link (it just a testing place, so far):
http://focofijo2.webcindario.com/Galeria/

If you need an user to check, you can use the admin one:
user: admin
pass: admin
Logged

Joachim Müller

  • Dev Team member
  • Coppermine addict
  • ****
  • Offline Offline
  • Gender: Male
  • Posts: 47843
  • aka "GauGau"
    • gaugau.de
Re: Limit uploads per day
« Reply #4 on: June 28, 2010, 11:50:56 am »

If you need an user to check, you can use the admin one:
Posting an admin account publicly is silly and dangerous and not what I have requested. Any malevolent visitor of this forum could use the admin account data to hack that webspace or leave a backdoor behind. I have logged in with that account and changed the password for security reasons. All you did was causing an extra moderation effort.

Sorry, I didn't think you need to see the gallery, since it wasn't anything wrong with it.
We need to see it no matter what - that's the meaning of the word "mandatory" in the corresponding board rule thread, for reasons that we're not ready to repeat over and over. If you want to find out why a particular board rules exists, search for previous discussions.

I get an error. Can't recognize the "db_query"
the function name has been changed from cpg1.3.x to cpg1.4.x from db_query to cpg_db_query to avoid issues when bridging as discussed in many threads back then. You can't blindly copy stuff from cpg1.3.x and try that in cpg1.5.x, especially when accessing the database; you need to know what you're doing.
Logged

ThunderRed

  • Coppermine newbie
  • Offline Offline
  • Posts: 15
Re: Limit uploads per day
« Reply #5 on: June 29, 2010, 02:10:01 am »

Posting an admin account publicly is silly and dangerous and not what I have requested. Any malevolent visitor of this forum could use the admin account data to hack that webspace or leave a backdoor behind. I have logged in with that account and changed the password for security reasons. All you did was causing an extra moderation effort.
We need to see it no matter what - that's the meaning of the word "mandatory" in the corresponding board rule thread, for reasons that we're not ready to repeat over and over. If you want to find out why a particular board rules exists, search for previous discussions.
the function name has been changed from cpg1.3.x to cpg1.4.x from db_query to cpg_db_query to avoid issues when bridging as discussed in many threads back then. You can't blindly copy stuff from cpg1.3.x and try that in cpg1.5.x, especially when accessing the database; you need to know what you're doing.

Sorry to give you extra problems. I didn't really matters about the admin user, since it not the same user or pass to get to the website, only to connect to the gallery, which is only up for testing purposes so far in a free hosting place, that's why I give it to you.. but sorry that this suppose an extra work for you, that wasn't my intention.

I knew that the mod wasn't working, but I wanted to answer the other guy that asking what happens.

Anyways, thanks for the help, I would try now with the different name. I would let you know if that works.
Logged

ThunderRed

  • Coppermine newbie
  • Offline Offline
  • Posts: 15
Re: Limit uploads per day
« Reply #6 on: June 30, 2010, 03:04:31 am »

Did something else change from one version to the other? Or did I have to put this in a special place?

I can't make it work so far.

I made an standalone installation now:

user:test
pass: test1

http://focofijo2.webcindario.com/Galeria/index.php


So, if this code correct or need more modification? Anyone tried?

Code: [Select]
$query = cpg_db_query("SELECT * FROM {$CONFIG['TABLE_PICTURES']} WHERE owner_id = ".USER_ID." AND ctime > ".UNIX_TIMESTAMP(NOW())." - (24*60*60)");
if (mysql_num_rows($query) > 0) {
cpg_die(INFORMATION, "You have reached your upload quota of 1 picture per 24hr.");
}


thanks for you time
Logged

Αndré

  • Administrator
  • Coppermine addict
  • *****
  • Country: de
  • Offline Offline
  • Gender: Male
  • Posts: 15764
Re: Limit uploads per day
« Reply #7 on: June 30, 2010, 07:57:35 am »

Please try
Code: [Select]
$result = cpg_db_query("SELECT * FROM {$CONFIG['TABLE_PICTURES']} WHERE owner_id = ".USER_ID." AND ctime > UNIX_TIMESTAMP(NOW()) - (24*60*60)");
if (mysql_num_rows($result) > 0) {
cpg_die(INFORMATION, "You have reached your upload quota of 1 picture per 24hr.");
}
mysql_free_result($result);
Logged

ThunderRed

  • Coppermine newbie
  • Offline Offline
  • Posts: 15
Re: Limit uploads per day
« Reply #8 on: June 30, 2010, 12:34:11 pm »

it's looks like working!

I will have to try tomorrow if I can upload something, but so far, so good!!

Thank you!!
Logged

Αndré

  • Administrator
  • Coppermine addict
  • *****
  • Country: de
  • Offline Offline
  • Gender: Male
  • Posts: 15764
Re: Limit uploads per day
« Reply #9 on: June 30, 2010, 12:54:56 pm »

The current solution lets you only upload a file every 24 hours. Detecting 'today' can be difficult with users from different time zones.

E.g. if you have uploaded your last image yesterday 10 PM, you're not allowed to upload your next image until today 10 PM.
Logged

Joe Carver

  • Dev Team member
  • Coppermine addict
  • ****
  • Country: us
  • Offline Offline
  • Gender: Male
  • Posts: 1545
  • aka 'i-imagine'
    • Home Page
Re: Limit uploads per day
« Reply #10 on: June 30, 2010, 11:48:06 pm »

Good one. It would be a good candidate for a plugin IMO.

Αndré

  • Administrator
  • Coppermine addict
  • *****
  • Country: de
  • Offline Offline
  • Gender: Male
  • Posts: 15764
Re: Limit uploads per day
« Reply #11 on: July 01, 2010, 08:27:26 am »

Yes. Concerning to the 'x uploads per day' issue, we could choose the admin to determine the day according to the timezone difference the admin has set or allow only x uploads per 24 hours. I'll try to release such a plugin in the next days.
Logged

ThunderRed

  • Coppermine newbie
  • Offline Offline
  • Posts: 15
Re: Limit uploads per day
« Reply #12 on: July 01, 2010, 12:40:05 pm »

That sound really good.

By the way, how we could print how much time you have to keep waiting before upload?

So you get one message like this:

"You have reached your upload quota of 1 picture per 24hr. You have to wait another 3 hours before upload another file."


Thanks!
Logged

Αndré

  • Administrator
  • Coppermine addict
  • *****
  • Country: de
  • Offline Offline
  • Gender: Male
  • Posts: 15764
Re: Limit uploads per day
« Reply #13 on: July 02, 2010, 11:14:31 am »

how we could print how much time you have to keep waiting before upload?

So you get one message like this:

"You have reached your upload quota of 1 picture per 24hr. You have to wait another 3 hours before upload another file."
Calculate the difference between MAX(ctime) of that user and time(). Will be added to the plugin as well.
Logged

Αndré

  • Administrator
  • Coppermine addict
  • *****
  • Country: de
  • Offline Offline
  • Gender: Male
  • Posts: 15764
Re: Limit uploads per day
« Reply #14 on: July 06, 2010, 03:07:35 pm »

Please see here for a first (and later the final) version of the plugin.
« Last Edit: July 06, 2010, 03:21:54 pm by Αndré »
Logged
Pages: [1]   Go Up
 

Page created in 0.03 seconds with 20 queries.