Author Topic: Anzahl beschränken!!!  (Read 3577 times)

0 Members and 1 Guest are viewing this topic.

Offline Ken

  • Newbie
  • *
  • Posts: 16
    • View Profile
    • http://www.artx-factory.com
Anzahl beschränken!!!
« on: December 12, 2002, 08:19:04 AM »
HI zusammen

gibt es eine Möglichkeit, das die registrierte User nur ein bestimmte Anzahl (z.B. 5) an Bildern,  in die Galerie hochladen können?

Da ich zur Zeit nicht allzuviel Webspace habe, sollte es es für den Anfang eben begrenzt sein.

Ist es möglich und kann es mir jemand Schritt für Schritt erklären?

Danke  :P
Wenn Ihr Lust aufs zeichnen habt oder es erlernen wollt, dann seit ihr hier richtig.
http://www.artx-factory.com

Offline Der_Nick

  • Newbie
  • *
  • Posts: 46
    • View Profile
    • http://www.fetteseite.com
Anzahl beschränken!!!
« Reply #1 on: December 13, 2002, 12:06:48 AM »
ich hab das hier mal hier im forum gefunden! hab es bei mir auf 20 pics begrenzt und es funzt!

Quote
I created a really really bad hack for this:

in member.php, about line 236 (right before if ($action == "uploadform") { ) I added the following:

$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))) {

Please note that this is hard-coded and applies to all user levels. The error message is just the incorrect login error, so it's not friendly. If you attempt to use this code and something goes wrong, please don't blame me. It seems to work ok for me, but I can't say if it will work for you.

Of course I would like to see a good solution, where the image limit is set per gallery through user levels. Until then, I will have to use my bad hack.

Offline Ken

  • Newbie
  • *
  • Posts: 16
    • View Profile
    • http://www.artx-factory.com
Anzahl beschränken!!!
« Reply #2 on: December 13, 2002, 08:36:54 PM »
HI

irgendwie sieht es bei mir in Zeile 236, member.php ganz anders aus, so etwa

Code: [Select]
"lang_yes" => $lang['yes'],
    "lang_no" => $lang['no']
  ));
  $content = $site_template->parse_template("member_editcomment");


Was muss ich den genau tun?
Wenn Ihr Lust aufs zeichnen habt oder es erlernen wollt, dann seit ihr hier richtig.
http://www.artx-factory.com