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: maximum uploading  (Read 4935 times)

0 Members and 1 Guest are viewing this topic.

tjiepie

  • Coppermine novice
  • *
  • Offline Offline
  • Posts: 39
maximum uploading
« on: February 26, 2009, 09:39:54 am »

Hello dear,
I have a big site with more than 60000 pictures and 5000 members.
I don’t like it “the disk quota” (maximum store pictures on the site)

I searching for a small mod.
Example:

Every member can maximum uploading 50 pictures in 24houres or in 1 day.
After 24houres reset it back to 50pictures and the member can again uploading 50 pictures. But we don’t use a disk quote.

Is it possible?

Sorry for my English aim a Dutch member.
Logged

Hein Traag

  • Dev Team member
  • Coppermine addict
  • ****
  • Country: nl
  • Offline Offline
  • Gender: Male
  • Posts: 2166
  • A, B, Cpg
    • Personal website - Spintires.nl
Re: maximum uploading
« Reply #1 on: February 26, 2009, 09:50:24 am »

Don't know if there is a mod that does what you need. But did you look through the mod/upload section? It's here http://forum.coppermine-gallery.net/index.php/board,72.0.html
Logged

Stramm

  • Dev Team member
  • Coppermine addict
  • ****
  • Country: 00
  • Offline Offline
  • Gender: Male
  • Posts: 6006
    • Bettis Wollwelt

tjiepie

  • Coppermine novice
  • *
  • Offline Offline
  • Posts: 39
Logged

Joachim Müller

  • Dev Team member
  • Coppermine addict
  • ****
  • Offline Offline
  • Gender: Male
  • Posts: 47843
  • aka "GauGau"
    • gaugau.de
Re: maximum uploading
« Reply #4 on: February 27, 2009, 07:33:41 am »

Then do as suggested in that thread and apply the changes for cpg1.4.x if you can: the function db_query has been renamed from cpg1.3.x to cpg1.4.x to cpg_db_query. There have been other changes, but those changes probably don't apply for such a small snippet of code. If you can not apply those changes (lack of coding skills), then you're stuck and will have to wait for someone to code this for you.
Logged

tjiepie

  • Coppermine novice
  • *
  • Offline Offline
  • Posts: 39
Re: maximum uploading
« Reply #5 on: February 27, 2009, 09:27:53 am »

I try it but i get the same error  :'(

**** = I don't publish my webpage here.

Code: [Select]
Fatal error: Call to undefined function cpg_db_query() in /customers/******/*****/httpd.www/*****/upload.php on line 3

I added these code in the upload.php file

Code: [Select]
$query = cpg_db_query("SELECT unique_ID FROM {$CONFIG['TABLE_TEMPDATA']} WHERE owner_id = '$user_Iid' AND ctime > NOW() - (24*60*60)");
if (mysql_num_rows($query) > 50) {
cpg_die(INFORMATION, "You have reached your upload quota of 50 picture per 24hr.");
require('include/init.inc.php');
}
Logged

tjiepie

  • Coppermine novice
  • *
  • Offline Offline
  • Posts: 39
Re: maximum uploading
« Reply #6 on: February 27, 2009, 09:41:59 am »

Edit code

Code: [Select]
$query = cpg_db_query("SELECT unique_ID FROM {$CONFIG['TABLE_TEMPDATA']} WHERE owner_id = '$user_id' AND ctime > NOW() - (24*60*60)");
if (mysql_num_rows($query) > 50) {
cpg_die(INFORMATION, "You have reached your upload quota of 50 picture per 24hr.");
require('include/init.inc.php');
}
Logged

Joachim Müller

  • Dev Team member
  • Coppermine addict
  • ****
  • Offline Offline
  • Gender: Male
  • Posts: 47843
  • aka "GauGau"
    • gaugau.de
Re: maximum uploading
« Reply #7 on: February 27, 2009, 02:19:28 pm »

**** = I don't publish my webpage here.
too bad for you then.... ::)
Logged

tjiepie

  • Coppermine novice
  • *
  • Offline Offline
  • Posts: 39
Re: maximum uploading
« Reply #8 on: February 27, 2009, 03:30:14 pm »

too bad for you then.... ::)

Why?

You can see the error
Code: [Select]
Fatal error: Call to undefined function cpg_db_query() in upload.php on line 3

I place these code in the upload.php file.

Code: [Select]
$query = cpg_db_query("SELECT unique_ID FROM {$CONFIG['TABLE_TEMPDATA']} WHERE owner_id = '$user_id' AND ctime > NOW() - (24*60*60)");
if (mysql_num_rows($query) > 50) {
cpg_die(INFORMATION, "You have reached your upload quota of 50 picture per 24hr.");
require('include/init.inc.php');
}

The code in line 3 are

Code: [Select]
$query = cpg_db_query("SELECT unique_ID FROM {$CONFIG['TABLE_TEMPDATA']} WHERE owner_id = '$user_id' AND ctime > NOW() - (24*60*60)");
Logged

Nibbler

  • Guest
Re: maximum uploading
« Reply #9 on: February 27, 2009, 03:59:48 pm »

Read the instructions more carefully. Should be like this

Code: [Select]
require('include/init.inc.php');

$query = cpg_db_query("SELECT unique_ID FROM {$CONFIG['TABLE_TEMPDATA']} WHERE owner_id = '$user_id' AND ctime > NOW() - (24*60*60)");
if (mysql_num_rows($query) > 50) {
cpg_die(INFORMATION, "You have reached your upload quota of 50 picture per 24hr.");
}

Not sure what that db query is supposed to be doing though.
Logged

tjiepie

  • Coppermine novice
  • *
  • Offline Offline
  • Posts: 39
Re: maximum uploading
« Reply #10 on: February 27, 2009, 04:36:44 pm »

Hello Nibbler, thanks for the code
I added these code in the upload.php file

Code: [Select]
require('include/init.inc.php');

$query = cpg_db_query("SELECT unique_ID FROM {$CONFIG['TABLE_TEMPDATA']} WHERE owner_id = '$user_id' AND ctime > NOW() - (24*60*60)");
if (mysql_num_rows($query) > 50) {
cpg_die(INFORMATION, "You have reached your upload quota of 50 picture per 24hr.");
}

If i click on the button "upload file" i see these text:  Not in Coppermine...   
(not more)

Logged

Nibbler

  • Guest
Re: maximum uploading
« Reply #11 on: February 27, 2009, 04:54:06 pm »

Original top of upload.php is

Code: [Select]
<?php
/*************************
  Coppermine Photo Gallery
  ************************
  Copyright (c) 2003-2009 Coppermine Dev Team
  v1.1 originally written by Gregory DEMAR

  This program is free software; you can redistribute it and/or modify
  it under the terms of the GNU General Public License version 3
  as published by the Free Software Foundation.
  
  ********************************************
  Coppermine version: 1.4.20
  $HeadURL: https://coppermine.svn.sourceforge.net/svnroot/coppermine/trunk/cpg1.4.x/upload.php $
  $Revision: 5705 $
  $Author: gaugau $
  $Date: 2009-01-28 10:52:43 +0100 (Wed, 28 Jan 2009) $
**********************************************/

// Confirm we are in Coppermine and set the language blocks.
define('IN_COPPERMINE'true);
define('UPLOAD_PHP'true);
define('DB_INPUT_PHP'true);
define('ADMIN_PHP'true);

// Call basic functions, etc.
require('include/init.inc.php');
require(
'include/picmgmt.inc.php');

Under that you add the new code

Code: [Select]
$result = cpg_db_query("SELECT COUNT(*) FROM {$CONFIG['TABLE_PICTURES']} WHERE owner_id = '$user_id' AND ctime > UNIX_TIMESTAMP() - (24*60*60)");
list($numpics) = mysql_fetch_row($result);
if ($numpics > 50) {
cpg_die(INFORMATION, "You have reached your upload quota of 50 picture per 24hr.");
}
Logged

tjiepie

  • Coppermine novice
  • *
  • Offline Offline
  • Posts: 39
Re: maximum uploading
« Reply #12 on: February 27, 2009, 05:28:44 pm »

Thanks Nibbler for the support. It's working :)

Now can I added these code also in the JUpload plugin? (v3.2.3)

Logged

tjiepie

  • Coppermine novice
  • *
  • Offline Offline
  • Posts: 39
Re: maximum uploading
« Reply #13 on: February 27, 2009, 06:13:19 pm »

Okay i found it to :)

Thanks for the support
Logged
Pages: [1]   Go Up
 

Page created in 0.023 seconds with 21 queries.