forum.coppermine-gallery.net

Support => cpg1.4.x Support => Older/other versions => cpg1.4 upload => Topic started by: tjiepie on February 26, 2009, 09:39:54 am

Title: maximum uploading
Post by: tjiepie 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.
Title: Re: maximum uploading
Post by: Hein Traag 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 (http://forum.coppermine-gallery.net/index.php/board,72.0.html)
Title: Re: maximum uploading
Post by: Stramm on February 26, 2009, 08:42:24 pm
http://forum.coppermine-gallery.net/index.php/topic,15874.0.html
Title: Re: maximum uploading
Post by: tjiepie on February 27, 2009, 05:23:38 am
http://forum.coppermine-gallery.net/index.php/topic,15874.0.html

Thats for cpg1.3 I have 1.4  ;D
Title: Re: maximum uploading
Post by: Joachim Müller 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.
Title: Re: maximum uploading
Post by: tjiepie 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');
}
Title: Re: maximum uploading
Post by: tjiepie 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');
}
Title: Re: maximum uploading
Post by: Joachim Müller on February 27, 2009, 02:19:28 pm
**** = I don't publish my webpage here.
too bad for you then.... ::)
Title: Re: maximum uploading
Post by: tjiepie 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)");
Title: Re: maximum uploading
Post by: Nibbler 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.
Title: Re: maximum uploading
Post by: tjiepie 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)

Title: Re: maximum uploading
Post by: Nibbler 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.");
}
Title: Re: maximum uploading
Post by: tjiepie 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)

Title: Re: maximum uploading
Post by: tjiepie on February 27, 2009, 06:13:19 pm
Okay i found it to :)

Thanks for the support