Author Topic: Upload Limit  (Read 15415 times)

0 Members and 1 Guest are viewing this topic.

Offline teddy

  • Newbie
  • *
  • Posts: 43
    • View Profile
Upload Limit
« on: October 25, 2002, 06:44:40 AM »
Hallo zusammen,

ist es möglich ein Upload Limit einzubauen?
So das jeder User bei einer Anzahl von z.b. 50 Fotos gar nichts mehr hochladen kann,  stattdessen eine Fehlermeldung erhält?
Wenn der User wieder unter 50 Fotos hat, soll es wieder gehen.

Danke im voraus
Gruß Uwe
DigiCamTalk

Offline Tommy

  • Newbie
  • *
  • Posts: 13
    • View Profile
    • http://www.rendertown.de
Upload Limit
« Reply #1 on: October 25, 2002, 04:38:08 PM »
Hi Uwe,

schau Dir mal die 2 threads an:

http://www.4homepages.de/forum/viewtopic.php?t=2261

und

http://www.4homepages.de/forum/viewtopic.php?t=1128

Ich denke, das bringt Dich schon mal ein Stück weiter ;)

cu

tommy

Offline Elanor

  • Newbie
  • *
  • Posts: 13
    • View Profile
    • http://4visions.net
Upload Limit
« Reply #2 on: October 26, 2002, 01:27:14 PM »
So wie ich das verstanden habe, bezieht sich das eine auf max Bilder User/Tag und das andere auf max Bilder  User/Kategorie
(korrigiert mich wenn ich da falsch liege ^^).
Hat jedenfalls beides bei mir nicht so richtig funktioniert. Vielleicht weil ich keinen direkten Upload in der Gallery erlaube.

Gibt es eine Möglichkeit die max Anzahl aller Bilder pro User zu beschränken (egal in welcher Kategorie sie liegen)? Und falls ja, wird der indirekte Upload berücksichtigt? (Der User erhält erhält eine Fehlermeldung bei überschrittenem Limit, auch wenn das Bild noch nicht freigeschaltet wurde).
Und zu guter Letzt: funktioniert das ganze auch, wenn 4I in VBulletin integriert wurde?

Würde mich sehr auf eine Antwort freuen ^^
(Ps.: ich fände das wäre auch ein gutes Standardfeature ...nur so als Idee)

Offline teddy

  • Newbie
  • *
  • Posts: 43
    • View Profile
Upload Limit
« Reply #3 on: October 27, 2002, 06:43:08 PM »
Hallo zusammen,

erstmal Danke an Tommy für die Links.

Das habe ich ausprobiert und es klappt:

http://www.4homepages.de/forum/viewtopic.php?t=1128

Ich kenne mich mit MySQL kaum aus, weiß also nicht, wie man die Gesamtzahl der Bilder pro User ausliest.

Ich versuche z.Z. das hinzukriegen. Wäre aber für eine Lösung dankbar, denn im Moment verzweifle ich daran.
Gruß Uwe
DigiCamTalk

Offline teddy

  • Newbie
  • *
  • Posts: 43
    • View Profile
Upload Limit
« Reply #4 on: October 28, 2002, 09:03:00 AM »
Hallo zusammen,
nach einigen Test komme ich zu diesem Ergebnis:

Original von Lisa:
$user_id = $user_info['user_id'];

function check_cat_limit($cat_id, $user_id) {
$sql = "SELECT image_id FROM 4images_images WHERE cat_id=$cat_id AND user_id=$user_id";
$result = mysql_query($sql);
$cat_images_user = mysql_num_rows($result);

if($cat_images_user >= 5) {
return false;
} else {
return true;

}
}

and added "!check_cat_limit($cat_id, $user_id)" to the second line of if ($action == "uploadform") { as:

if ($cat_id != 0 && (!isset($cat_cache[$cat_id]) || !check_permission("auth_up
load", $cat_id) || !check_cat_limit($cat_id, $user_id))) {


Von mir verändert:
$user_id = $user_info['user_id'];

function check_cat_limit($user_id) {
$sql = "SELECT image_id FROM 4images_images WHERE user_id = $user_id";
$result = mysql_query($sql);
$cat_images_user = mysql_num_rows($result);

if($cat_images_user >= 5) {
return false;
}else{
return true;
}
}

if ($action == "uploadform") {
  if ($cat_id != 0 && (!isset($cat_cache[$cat_id]) || !check_permission("auth_upload", $cat_id) || !check_cat_limit($user_id) )) {


Alles was Fett ist, habe ich verändert, es war nicht viel, nur alles mit cat_id gelöscht.

Ich hoffe, das ist die Endlösung.
Gruß Uwe
DigiCamTalk

Offline cyber

  • Jr. Member
  • **
  • Posts: 62
    • View Profile
Upload Limit
« Reply #5 on: October 31, 2002, 02:46:46 AM »
Can you translate for english? I'm interested on put a limit for uploads.. tks

Offline teddy

  • Newbie
  • *
  • Posts: 43
    • View Profile
Upload Limit
« Reply #6 on: October 31, 2002, 08:52:07 AM »
Hi cyber,
i'll try to translate:

what lisa wrote works fine, it is only setting a upload limit for each category.

this is, what i made:
i killed all the words wich includes cat_id
---------------------
lisa:
function check_cat_limit($cat_id, $user_id) {

teddy:
function check_cat_limit($user_id) {
---------------------

lisa:
$sql = "SELECT image_id FROM 4images_images WHERE cat_id=$cat_id AND user_id=$user_id";

teddy:
$sql = "SELECT image_id FROM 4images_images WHERE user_id = $user_id";
----------------------

lisa:
if ($cat_id != 0 && (!isset($cat_cache[$cat_id]) || !check_permission("auth_upload", $cat_id) || !check_cat_limit($cat_id, $user_id))) {

teddy:
if ($cat_id != 0 && (!isset($cat_cache[$cat_id]) || !check_permission("auth_upload", $cat_id) || !check_cat_limit($user_id) )) {
---------------------

That's all and it works fine.

if($cat_images_user >= 5) {
5 is an example, you can modify it. It says how much Pictures a user can upload.


My english isn't good, but I hope you understand this.
Gruß Uwe
DigiCamTalk

Offline cyber

  • Jr. Member
  • **
  • Posts: 62
    • View Profile
Align
« Reply #7 on: November 01, 2002, 02:08:13 AM »
What i need to do to have automatic the categories by align by name
like
An
Bn
Cn
..

Offline Fireball22

  • Full Member
  • ***
  • Posts: 187
    • View Profile
Re: Upload Limit
« Reply #8 on: May 07, 2006, 03:50:36 PM »
Sehr interessante Änderung!
Würde genau das gleiche benötigen!

Einziges Problem ist, dass das ganze nur geht, wenn man nicht eingeloggt ist.
Geht das auch irgendwie wenn man eingeloggt ist?
Hab mir die Änderungen mal angeschaut und müsste eigentlich gehen, mit dem Code von "lisa", aber wenn ich den Code von "lisa" einbau, dann geht keines von beiden.

Wo liegt das Problem?

Das genze sieht bei mir im Moment so aus:

Code: [Select]
// WARNING CHANGE HERE!!

$user_id = $user_info['user_id'];

function check_cat_limit($cat_id, $user_id) {
        $sql = "SELECT image_id FROM 4images_images WHERE cat_id=$cat_id AND user_id=$user_id";
        $result = mysql_query($sql);
        $cat_images_user = mysql_num_rows($result);

        if($cat_images_user >= 5) {
                return false;
        } else {
                return true;

        }
}

// WARNING CHANGE HERE ENDED!!

if ($action == "uploadform") {
if ($cat_id != 0 && (!isset($cat_cache[$cat_id]) || !check_permission("auth_upload", $cat_id) || !check_cat_limit($cat_id, $user_id))) {
  show_error_page($lang['no_permission']);
    exit;
  }

Fireball22

Offline Fireball22

  • Full Member
  • ***
  • Posts: 187
    • View Profile
Re: Upload Limit
« Reply #9 on: May 09, 2006, 02:42:43 PM »
Hat keiner eine Ahnung wie ich das Problem lösen könnte?

Fireball22

Offline max.cady

  • Jr. Member
  • **
  • Posts: 67
    • View Profile
Re: Upload Limit
« Reply #10 on: May 09, 2006, 06:40:02 PM »
wenn ich teddy richtig verstanden habe, musst du alles, wo cat_id vorkommt löschen .. ?

Offline Fireball22

  • Full Member
  • ***
  • Posts: 187
    • View Profile
Re: Upload Limit
« Reply #11 on: May 09, 2006, 07:11:03 PM »
Genau, das habe ich auch schon ausprobiert, dann geht es!
Aber dann hab ich wiedrrum das Problem, dass es für angemeldete User nicht gilt und ich dachte mir, dass lässt sich damit beheben, indem noch user_id dran steht?!

Fireball22

Offline Fireball22

  • Full Member
  • ***
  • Posts: 187
    • View Profile
Re: Upload Limit
« Reply #12 on: May 11, 2006, 02:52:22 PM »
kann mir keiner helfen?!  :?
Ist so wirklich total dumm, wenn jeder unendlich viele Dateien hochladen kann!!

Fireball22

Offline max.cady

  • Jr. Member
  • **
  • Posts: 67
    • View Profile
Re: Upload Limit
« Reply #13 on: May 13, 2006, 09:17:18 AM »
Hat jemand schonmal versucht, ob es klappt das upload limit per .htaccess zu beschränken?

http://de2.php.net/manual/de/ini.sect.file-uploads.php#ini.upload-max-filesize@title=Datei%20Uploads

Wenn man z.B. in den upload Ordner eine .htaccess Datei packt und da dann reinschreibt

php_value upload_max_filesize 500000

würde das dann den upload auf 500 kb beschränken?


for the English speaking profs :)
Has anybody already tried to limit the upload in an .htaccess file?
Would it work to limit the upload to for example 500 kb by placing an .htaccess file in the upload folder with the following code

php_value upload_max_filesize 500000

?

Offline Fireball22

  • Full Member
  • ***
  • Posts: 187
    • View Profile
Re: Upload Limit
« Reply #14 on: May 13, 2006, 11:23:53 AM »
Ich glaube jetzt mal, dass man es in PHP-Code packen kann, aber .htaccess?
Normalerweiße ist sowas sonst nur mit Quota unter Linux möglich, dazu bräuchte man dann aber einen extra FTP-Account für 4Images.

Aber es gibt auch nachteile bei dieser Methode!
Es wären beispielsweise keine Fehlerdokumente möglich, bei Überschreitung und ein MySQL-Eintrag wird trotzdem angelegt, also wäre dass das totale Chaos.

Aber wäre super, wenn du vielleicht rausfindest, warum der Code oben nicht geht...

Fireball22