4images Forum & Community

4images Issues / Ausgaben => Discussion & Troubleshooting => Topic started by: Bomba on February 20, 2003, 04:19:44 AM

Title: upload limit by time
Post by: Bomba on February 20, 2003, 04:19:44 AM
is it possible to limit the upload limit by time
like only one image per day (24 hours) ?
Title: upload limit by time
Post by: V@no on February 20, 2003, 04:24:17 AM
no, it's not possible.
And I dont recall any mods for that.
Title: upload limit by time
Post by: Bomba on February 20, 2003, 04:25:18 AM
:cry: ok

thanks for your quick answer
Title: upload limit by time
Post by: Ernesto Taseffa on February 26, 2003, 01:31:38 PM
.
Title: upload limit by time
Post by: V@no on February 26, 2003, 06:25:46 PM
well, actualy there is a way to do so, without any modification of database.
since each uploaded photo has date when it was uploaded, it's possible make a script that will check last uploaded by that user picture and check the date.
but, this way only would work correctly when the category has "direct upload" permission. otherwise, uploaded date will be when admin validated it.
Title: upload limit by time
Post by: Ernesto Taseffa on February 26, 2003, 07:21:31 PM
.
Title: upload limit by time
Post by: FreDyz on March 13, 2003, 10:46:02 AM
Quote from: V@no
well, actualy there is a way to do so, without any modification of database.
but, this way only would work correctly when the category has "direct upload" permission. otherwise, uploaded date will be when admin validated it.


Hmmm!! It's indeed what I was looking for, in my Web all the categories have "direct upload" permission.

Can you explain how to make the script? I don't know PHP :(

Thanks
Title: Re: upload limit by time
Post by: zoolmann on January 11, 2006, 12:24:47 AM
How please create the upload limit by one image per day (24 hours) ?

PLEASE  :cry: :cry: :cry:
Title: Re: upload limit by time
Post by: V@no on January 11, 2006, 12:39:51 AM
Try this (no guests support). In member.php find:
Code: [Select]
if ($action == "uploadform") {
  if ($cat_id != 0 && (!isset($cat_cache[$cat_id]) || !check_permission("auth_upload", $cat_id))) {
    show_error_page($lang['no_permission']);
    exit;
  }

Insert below:
Code: [Select]
  if ($user_info['user_level'] > GUEST && $user_info['user_level'] != ADMIN)
  {
    $sql = "SELECT COUNT(image_id) AS num
            FROM ".IMAGES_TABLE."
            WHERE user_id = ".$user_info['user_id']." AND image_date > ".(time()-60*60*24);
    if ($result = $site_db->query_firstrow($sql))
    {
      if ($result['num'] >= 1)
      {
        $lang['upload_limit_reached'] = "Sorry, your upload limit per 24 hours has been reached";
        show_error_page($lang['upload_limit_reached']);
        exit;
      }
    }
  }

Also, it wont hurt if you also insert the same code below:
Code: [Select]
if ($action == "uploadimage") {
  if ($cat_id != 0 && (!isset($cat_cache[$cat_id]) || !check_permission("auth_upload", $cat_id))) {
    show_error_page($lang['no_permission']);
    exit;
  }


Done :)

Its not so hard to figure out what numbers must be changed if you want use different timing and number of allowed images per that time ;)

P.S. you can move
Code: [Select]
$lang['upload_limit_reached'] = "Sorry, your upload limit per 24 hours has been reached"; into lang/<your language>/main.php
Title: Re: upload limit by time
Post by: zoolmann on January 11, 2006, 10:36:34 PM
it's not functional (it is no go)  :cry:

help me please!
Title: Re: upload limit by time
Post by: V@no on January 12, 2006, 12:46:33 AM
Ok, now should defenetly work. Make sure you test it with a regular member, not admin.
Title: Re: upload limit by time
Post by: zoolmann on January 13, 2006, 05:59:59 PM
Im tested as reg. member...  :roll:

it's not functional

help me please !!!!!!
Title: Re: upload limit by time
Post by: V@no on January 14, 2006, 12:54:36 AM
Im tested as reg. member...  :roll:

it's not functional

help me please !!!!!!
I've tested on fresh v1.7 and v1.7.1 - works fine for me. You do something wrong then or possible some other mods interfernce.
Title: Re: upload limit by time
Post by: zoolmann on January 16, 2006, 06:25:16 PM
Thank you V@no,
i have got installed MOD "small credit system" and there are some conflicts with this modifikation.

So I deleted "MOD CSS" a than :upload limit by time " works perfectly ;]
Title: Re: upload limit by time
Post by: Philmax on February 26, 2006, 10:34:40 PM
Hello Vano,
how can i limit the upload for example 10 Pics per Week?

I have many requests for this in my Gallery.

Title: Re: upload limit by time
Post by: V@no on February 26, 2006, 11:02:04 PM
[qcode]            WHERE user_id = ".$user_info['user_id']." AND image_date > ".(time()-60*60*24*7);
    if ($result = $site_db->query_firstrow($sql))
    {
      if ($result['num'] > 10)[/qcode]
Title: Re: upload limit by time
Post by: MrAndrew on July 20, 2010, 02:39:05 PM
Vano, May i show to user, in the error message, how many time remain for cancel his limit?
Title: Re: upload limit by time
Post by: sartravut on August 05, 2010, 01:51:44 PM
thanks for your quick answer
Title: Re: upload limit by time
Post by: joergW on October 19, 2010, 07:35:53 PM
Hello,

I picked up this old Thread because I searched for a solution limiting one upload per Day for example.

I copied the passages in my member.php of my homepage www.c124.de but after login and clicking the upload-button the following error occured.

Parse error: syntax error, unexpected $end in /var/www/web299/html/4images/member.php on line 1361

I checed the memmber.php but it only has 1355 lines.

What happend, what can I do ?

Greetings from germany

joergW

Title: Re: upload limit by time
Post by: Rembrandt on October 19, 2010, 07:44:48 PM
... but after login and clicking the upload-button the following error occured.....
irgend welche klammern oder semicolon beim kopieren vergessen?
kontrollier halt alles nochmal nach.

mfg Andi
Title: Re: upload limit by time
Post by: joergW on October 19, 2010, 10:05:25 PM
puuuh ... geschafft.

Wahrscheinlich hatte ich das Leerzeichen vor dem ersten Buchstaben nicht mitkopiert.

jetzt geht´s so wie ich mir vorstellte.

Danke / Thanks

joergW
Title: Re: upload limit by time
Post by: joergW on November 17, 2010, 02:19:56 PM
Moin,

nachdem das geänderte Script funktionierte, stellte ich fest, dass User trotzdem mehrfach uploaden können.
Bei mir ist das Limit im Firefox da, im InternetExplorer nicht.

Hat jemand eine Ahnung woran das liegen könnte ?

###
t works only with Firefox, but not with InternetExplorer on my normal User-Account und test-Accounts
Anybody any idea why it is so ?
###

bis denn

joergW

Title: Re: upload limit by time
Post by: digital24 on February 25, 2011, 08:08:01 PM
eingebaut und getestet unter 1.7.9 :

läuft einwandfrei unter IE-8 und Firefox..

 :D Danke !!

Wolfgang