maximum uploading maximum uploading
 

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

Main Menu

maximum uploading

Started by tjiepie, February 26, 2009, 09:39:54 AM

Previous topic - Next topic

0 Members and 2 Guests are viewing this topic.

tjiepie

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.

Hein Traag

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



Joachim Müller

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.

tjiepie

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

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


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


$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');
}


tjiepie

Edit code


$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');
}

Joachim Müller


tjiepie

Quote from: Joachim Müller on February 27, 2009, 02:19:28 PM
too bad for you then.... ::)

Why?

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


I place these code in the upload.php file.


$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


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

Nibbler

Read the instructions more carefully. Should be like this


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.

tjiepie

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


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)


Nibbler

Original top of upload.php is


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


$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.");
}

tjiepie

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

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


tjiepie

Okay i found it to :)

Thanks for the support