4images Forum & Community

4images Modifications / Modifikationen => Mods & Plugins (Releases & Support) => Topic started by: SLL on January 15, 2003, 01:46:11 PM

Title: [Mod] User upload limits
Post by: SLL on January 15, 2003, 01:46:11 PM
Code: [Select]
################################################################################################
## Title: User Upload Limits for 4images - Image Gallery Management System.
## Version: 1.2
## Author: Silly Little Lamer <sll@dalnet.ru>
## Description: This Mod sets limits to the number of images, that user could upload to the gallery.
## Default limit is set to all existing users during installation of this MOD, and can
## be changed later via Control Panel. Individual upload limits for every user can also
## be changed via Edit User Panel.
##
## New in v.1.2 - Daily limits + ability to check uploaded but not yet validated images.
##
##
## Installation Level: Medium
## Installation Time: 20 Minutes
##
## Files To Edit: 6
## /4images/member.php
## /4images/register.php
## /4images/admin/users.php
## /4images/admin/settings.php
## /4images/lang/english/admin.php
## /4images/lang/english/main.php
##
################################################################################################
download: http://faces.dalnet.ru/files.php?l=english (http://faces.dalnet.ru/files.php?l=english)
[EDIT]
updated instructions with fixes you can find attached to this post
In the original package the installation script is broken, please use the fixed version from attachment below.


[EDIT2]
more and more people reported errors when they try add a new user.
Please apply Lord Nite fix (http://www.4homepages.de/forum/index.php?topic=3607.msg27661#msg27661):
After mod installed find in admin/users.php:
Code: (MySQL) [Select]
($user_id, $user_level, '$user_name', '$user_password', '$user_email', $user_showemail, $user_allowemails, $user_invisible, $current_time, '$activationkey', $current_time, $current_time, 0, '$user_homepage', '$user_icq', $user_limit".$additional_value_sql.")";
Replace it with:
Code: [Select]
($user_id, $user_level, '$user_name', '$user_password', '$user_email', $user_showemail, $user_allowemails, $user_invisible, $current_time, '$activationkey', $current_time, $current_time, 0, '$user_homepage', '$user_icq', '$user_limit'".$additional_value_sql.")";
Title: [Mod] User upload limits
Post by: widgit1981 on January 16, 2003, 11:56:49 AM
Thanks a lot ! Havn't tried it yet though.

Maybe with this code someone will be able to do the same for download limits and change limits per user ? I think it will be as close as we could get to a credits system. Anyone up for the challenge PLEASE.....

Thanks

Steve
Title: [Mod] User upload limits
Post by: SLL on January 16, 2003, 12:02:21 PM
Quote from: widgit1981
Maybe with this code someone will be able to do the same for download limits and change limits per user ?


Unfortunately, it's absolutely useless to protect images downloads this way. To understand why, try to set "Scripting -> Disable" in your web browser, then go any image in your gallery, press right mouse button and select "Save Picture As..."
Title: [Mod] User upload limits
Post by: widgit1981 on January 16, 2003, 12:21:30 PM
That is where your wrong. My idea is that a medium sized image is on but it limits you to the full size image which is available via the download button. Ive already got a mod done for that. I want to limit the amount of download button clicks per user and change restrictions at will via the control panel.

I think it is possible but needs a little work. NE1???


Thanks

Steve
Title: [Mod] User upload limits
Post by: SLL on January 16, 2003, 02:24:46 PM
Quote from: widgit1981
My idea is that a medium sized image is on but it limits you to the full size image which is available via the download button.


I see... well, you could try to do exactly the same thing, as my MOD doing. Just add more fields to database and check download button instead of upload..
Title: [Mod] User upload limits
Post by: widgit1981 on January 16, 2003, 05:33:06 PM
Where do I do that ? Can you do the code for it ? Im no php coder

Even on your first line of edits it says:

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;
  }

Surely that will be different ?

Thanks

Steve
Title: [Mod] User upload limits
Post by: SLL on January 16, 2003, 11:56:58 PM
Quote from: widgit1981
Where do I do that ? Can you do the code for it ? Im no php coder


I'm not a PHP coder either  :lol:

I'm just running 4images gallery for IRC network users. I've tested more than 15 different image gallery scriprs, and found 4images much better than others. But, there still some features are missing, that's why I'm modifying it according to my needs.

I'm not sure that I'm good enough in PHP programming to make MOD requested by you... sorry...
Title: [Mod] User upload limits
Post by: widgit1981 on January 17, 2003, 04:19:15 PM
If anyone could do this please do I will be extremely greatful.

Steve
Title: [Mod] User upload limits
Post by: Vraxor on January 18, 2003, 08:01:41 PM
hmm, ok, this is interesting, but what does this mod do.

Is this a limit for ever, or just a dailly limit. I need a dailly limit as people might upload as much as they want but no more the 3 per day, is there a way to do that with this mod?

Cheers,
Vraxor
Title: [Mod] User upload limits
Post by: SLL on January 19, 2003, 01:06:19 AM
Quote from: Vraxor
Is this a limit for ever, or just a dailly limit. I need a dailly limit as people might upload as much as they want but no more the 3 per day, is there a way to do that with this mod?


At least not now. The number of uploads information is not stored in the database, so there's no way now to check this value. New DB field have to be added and checked before uploads.

This MOD sets the absolute number of permited uploads for every user. The default value is taken from gallery config. This default value and individual limit for any user can be edited via admin control pannel.

When I have some more free time, I see what I can do to add the feature you wanted...
Title: [Mod] User upload limits
Post by: x_789 on February 09, 2003, 11:15:00 PM
Hello I downloaded and installed your upload limiter I ran the install php and it said succesful.  I have looked in my control panel and I do not see where I can make changer to the amount of uploads a user can have.  Also I have created a test user and I was able to upload 7 images with out an issue I stoped at that point.  It looks like it is not working for me. my site is www.dirtyrc.com/gallery I am using a diffrent templete but I dont think that will matter. I do have backups of my db if I you would like me to try something again i did recieve SUCCESS when installing ...Thanks in advance X
Title: [Mod] User upload limits
Post by: V@no on February 09, 2003, 11:32:40 PM
but did u do all changes discribed in the instructions?
Title: [Mod] User upload limits
Post by: x_789 on February 09, 2003, 11:46:50 PM
The way I read the instructions was that you had to options run install ...php or do manaual install.  Are you telling me I have to make other changes also ?  

This is from the read me
Quote
# Unpack install_user_limits.php to your 4images root directory and run it. If you see "Success!"
# message, than all required fields and records were added to your database. Close this file, do
# not try to run in twice!
#
# Alternatively, you can perform these two queries manualy:
X
Title: [Mod] User upload limits
Post by: V@no on February 10, 2003, 12:43:03 AM
well, u missunderstud. its only about setting up database. the rest u'll need do manualy.
Title: [Mod] User upload limits
Post by: x_789 on February 16, 2003, 12:37:26 AM
Ok I have installed the script it went fine said successful then I didn't have any options in my control panel so I came here and user above said to contine editing files. I have edited all the files and I know have all the options in my control panel.  I delted a test user and registered again got and error in members.php so I redid that file now error cleared I uploaed and it never stoped me let me upload 17 before i quit when i set limit to 10 ... So I thought maybe I miskeyed in another file also so I delted all files started with a fresh backup of all files and then I redid all the editing and uploaded them no errors all funtions are in control panel but it does not stop me from uploading.  Any Ideas whats going on?   the only thing I did not do was in the top of the read me right under the info about the auto installer this text I didn't understand but I didn't think if the auto installer was sucessful I would need to do it
Quote
# Alternatively, you can perform these two queries manualy:
#
#   ALTER TABLE `4images_users` ADD `user_limit` SMALLINT(3) DEFAULT '5' NOT NULL;
#   INSERT INTO `4images_settings` (`setting_name`, `setting_value`) VALUES ('default_upload_limit', '5');
#



here is my website  www.dirtyrc.com/gallery

Any help greatly appriciated thanks in advance...X
Title: [Mod] User upload limits
Post by: amber438 on February 16, 2003, 10:33:37 PM
Hi..I wanted to get this mod but the link is dead..has it been taken down..?  Does it work??  The mod that is..

Thanks,
Amber :lol:
Title: [Mod] User upload limits
Post by: SLL on February 17, 2003, 08:35:56 AM
Some DNS problems at my host  :twisted:
Just added alternative d/l link in the first message.
Title: [Mod] User upload limits
Post by: x_789 on February 17, 2003, 06:02:03 PM
Ok the files that have to be modified are they specific to each persons server?  Or could I get a copy of someones files that have been modifed whos site is working and use them to test with that way I can figure out where my error is?  X
Title: [Mod] User upload limits
Post by: SLL on February 17, 2003, 09:41:11 PM
files are the same, if no other mod's used, but this wount help you much, since you have to modify your database also
Title: [Mod] User upload limits
Post by: x_789 on February 17, 2003, 09:50:12 PM
Ok what does the db modifications?  YouR install file?  I ran that like I said on the previous page and it  said it was sucessful.  The only thing I did not do was what I qouted on the bottom of the last page.  Also I have made no other mods to my site other than I use a diffrent template...X
Title: [Mod] User upload limits
Post by: x_789 on February 18, 2003, 11:28:12 PM
Ok well Since I knew nothing about php before this I was editing the files with wordpad.   I decided to look for a php editor and sure enough I found one.  So I uploaded my db backup and went through the whole thing again modifing all the files with the php editor..  So it looks like it kept the correct syntax.  Now it is working but I find that until I review the photos users can upload as many as they want.  As soon as I validate 5 photos then the next time they try to update they get the error that they are at limit.  Is there a  way to change this???  X
Title: [Mod] User upload limits
Post by: SLL on February 19, 2003, 09:52:58 AM
well... you can query 4images_images_temp table and check the number of images there against user id, but from my point of view it's not logical - nobody knows if uploaded images will be validated or deleted, so i'd prefer to leave this mod as it is, you can play with code yourself, if you want
Title: [Mod] User upload limits
Post by: Bomba on February 20, 2003, 04:24:22 AM
is it possible to make the upload limit by time?
in a way that users can only upload a pic per day
Title: [Mod] User upload limits
Post by: SLL on February 20, 2003, 09:00:02 AM
Quote from: Bomba
is it possible to make the upload limit by time?
in a way that users can only upload a pic per day

yes, you can do this. just replace the original mod function to this one:
Code: [Select]
function check_picture_limit($user_id) {
global $site_db, $site_template;

$sql = "SELECT user_limit FROM ".USERS_TABLE." WHERE user_id = $user_id";
$result = $site_db->query($sql);
$row = $site_db->fetch_array($result);
$upload_limit = ($row['user_limit']);
$site_template->register_vars("upload_limit", $upload_limit);

$limit_cutoff = time() - 60 * 60 * 24;

$sql = "SELECT COUNT(*) AS num_rows_all
FROM ".IMAGES_TABLE."
WHERE image_active = 1 AND user_id=$user_id AND image_date > $limit_cutoff";
$row = $site_db->query_firstrow($sql);
$images_per_user = $row['num_rows_all'];

$site_template->register_vars("images_per_user", $images_per_user);

if($images_per_user >= $upload_limit) {
return false;
} else {
return true;
}
}
Title: [Mod] User upload limits
Post by: IngoT on February 20, 2003, 03:12:06 PM
Is this change for a photo in 24 hours or per day (to 24 o'clock) The latter would be better.

CU Ingo.
Title: [Mod] User upload limits
Post by: SLL on February 20, 2003, 03:37:55 PM
it's an upload limit for the last 24 hours. the number of pics to upload, you set in the config, is the maximum per day it this case.
Title: [Mod] User upload limits
Post by: Bomba on February 23, 2003, 07:29:00 PM
awesome! :)

just one thing i have to put that code in wich file? the "install_user_limits.php" ? if so can u tell me what code should i look for to change.

sorry i'm really bad in this kind of things and im afraid of destroy everything.
thanks
Title: [Mod] User upload limits
Post by: V@no on February 23, 2003, 07:52:36 PM
Quote from: Bomba
awesome! :)

just one thing i have to put that code in wich file? the "install_user_limits.php" ? if so can u tell me what code should i look for to change.

sorry i'm really bad in this kind of things and im afraid of destroy everything.
thanks

this changes goes to member.php

P.S. install_user_limits.php does database installation.
Title: [Mod] User upload limits
Post by: Bomba on February 23, 2003, 08:34:46 PM
so i put this code:

Code: [Select]
function check_picture_limit($user_id) {
   global $site_db, $site_template;

$sql = "SELECT user_limit FROM ".USERS_TABLE." WHERE user_id = $user_id";
$result = $site_db->query($sql);
$row = $site_db->fetch_array($result);
$upload_limit = ($row['user_limit']);
$site_template->register_vars("upload_limit", $upload_limit);

$limit_cutoff = time() - 60 * 60 * 24;

$sql = "SELECT COUNT(*) AS num_rows_all
FROM ".IMAGES_TABLE."
WHERE image_active = 1 AND user_id=$user_id AND image_date > $limit_cutoff";
$row = $site_db->query_firstrow($sql);
$images_per_user = $row['num_rows_all'];

$site_template->register_vars("images_per_user", $images_per_user);

if($images_per_user >= $upload_limit) {
return false;
} else {
return true;
   }
}


in members.php ?
after what?
Title: [Mod] User upload limits
Post by: V@no on February 23, 2003, 08:38:32 PM
Quote from: SLL

yes, you can do this. just replace the original mod function to this one:
Code: [Select]
function check_picture_limit($user_id) {
global $site_db, $site_template;

$sql = "SELECT user_limit FROM ".USERS_TABLE." WHERE user_id = $user_id";
$result = $site_db->query($sql);
$row = $site_db->fetch_array($result);
$upload_limit = ($row['user_limit']);
$site_template->register_vars("upload_limit", $upload_limit);

$limit_cutoff = time() - 60 * 60 * 24;

$sql = "SELECT COUNT(*) AS num_rows_all
FROM ".IMAGES_TABLE."
WHERE image_active = 1 AND user_id=$user_id AND image_date > $limit_cutoff";
$row = $site_db->query_firstrow($sql);
$images_per_user = $row['num_rows_all'];

$site_template->register_vars("images_per_user", $images_per_user);

if($images_per_user >= $upload_limit) {
return false;
} else {
return true;
}
}

read instructions carefully :wink:
Title: [Mod] User upload limits
Post by: Bomba on February 23, 2003, 08:53:00 PM
well i put that code after
Code: [Select]
<?php  in the install_user_limits, is that correct?
Title: [Mod] User upload limits
Post by: SLL on February 23, 2003, 09:05:46 PM
no, it's not correct  :lol:

open the original mod installation instructions, find there function check_picture_limit and replace it with the function i gave you.
Title: [Mod] User upload limits
Post by: Bomba on February 23, 2003, 09:19:04 PM
i've changed that but now when i try to upload something it says "please choose image file!"

the code of my member.php is
Code: [Select]
));
      $media = $site_template->parse_template("media/".$file_extension);
      $content .= "<table border=\"0\" align=\"center\">\n<tr>\n<td>\n".$media."\n</td>\n</tr>\n</table>\n";
    }
    else {
      $action = "uploadform";
      $sendprocess = 1;
    }
  }
  else {
    $action = "uploadform";
    $sendprocess = 1;
  }
}

//-----------------------------------------------------
// --- Check User Limits ------------------------------
//-----------------------------------------------------

$user_id = $user_info['user_id'];

$clickstream = "<span class=\"clickstream\"><a href=\"".$site_sess->url(ROOT_PATH."index.php")."\" class=\"clickstream\">".$lang['home']."</a>".$config['category_separator'];
if ($cat_id && isset($cat_cache[$cat_id])) {
  $clickstream .= get_category_path($cat_id, 1).$config['category_separator'];
}
$clickstream .= $lang['file_upload_error']."</span>";

$site_template->register_vars(array(
"clickstream" => $clickstream,
"lang_no_limits" => $lang['no_limits'],
"lang_no_limits_text" => $lang['no_limits_text'],
"lang_already_loaded" => $lang['already_loaded'],
"lang_show_my_images" => $lang['show_my_images'],
"url_show_user_images" => $site_sess->url(ROOT_PATH."search.php?search_user=".$user_info['user_name'])
));

function check_picture_limit($user_id) {
   global $site_db, $site_template;

$sql = "SELECT user_limit FROM ".USERS_TABLE." WHERE user_id = $user_id";
$result = $site_db->query($sql);
$row = $site_db->fetch_array($result);
$upload_limit = ($row['user_limit']);
$site_template->register_vars("upload_limit", $upload_limit);

$limit_cutoff = time() - 60 * 60 * 24;

$sql = "SELECT COUNT(*) AS num_rows_all
FROM ".IMAGES_TABLE."
WHERE image_active = 1 AND user_id=$user_id AND image_date > $limit_cutoff";
$row = $site_db->query_firstrow($sql);
$images_per_user = $row['num_rows_all'];

$site_template->register_vars("images_per_user", $images_per_user);

if($images_per_user >= $upload_limit) {
return false;
} else {
return true;
   }
}

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;
 }

if ($cat_id != 0 && (!isset($cat_cache[$cat_id]) || !check_picture_limit($user_id))) {
$site_template->print_template($site_template->parse_template("over_limit"));
include(ROOT_PATH.'includes/page_footer.php');
exit;
}

//-----------------------------------------------------

  $txt_clickstream = "";
  if ($cat_id && isset($cat_cache[$cat_id])) {
    $txt_clickstream .= get_category_path($cat_id, 1).$config['category_separator'];
  }
  $txt_clickstream .= $lang['user_upload'];
Title: [Mod] User upload limits
Post by: SLL on February 23, 2003, 09:35:49 PM
this part seems to be ok. check if all other mod steps has been done right way.
Title: [Mod] User upload limits
Post by: Bomba on February 23, 2003, 10:04:27 PM
maybe the problem is that i already have installed once the install_user_limit.php and now if i try to do it for the second time it shows:
Code: [Select]
DB Error: Bad SQL Query: INSERT INTO 4images_settings () VALUES ('default_upload_limit', 5)
Duplicate entry 'default_upload_limit' for key 1

DB Error: Bad SQL Query: ALTER TABLE 4images_users ADD user_limit SMALLINT(3) DEFAULT 5 NOT NULL
Duplicate column name 'user_limit'
 
 


i know that the mod instructions say that we shouldn't do it twice. so what should i do?


here are the rest of the changed codes

register php:
Code: [Select]
$current_time = time();
    $user_level = ($config['account_activation'] == 0) ? USER : USER_AWAITING;
    $user_limit= $config['default_upload_limit'];
    $sql = "INSERT INTO ".USERS_TABLE."
            (".get_user_table_field("", "user_id").get_user_table_field(", ", "user_level").get_user_table_field(", ", "user_name").get_user_table_field(", ", "user_password").get_user_table_field(", ", "user_email").get_user_table_field(", ", "user_showemail").get_user_table_field(", ", "user_allowemails").get_user_table_field(", ", "user_invisible").get_user_table_field(", ", "user_joindate").get_user_table_field(", ", "user_activationkey").get_user_table_field(", ", "user_lastaction").get_user_table_field(", ", "user_lastvisit").get_user_table_field(", ", "user_comments").get_user_table_field(", ", "user_homepage").get_user_table_field(", ", "user_icq").(", ").('user_limit').$additional_field_sql.")
            VALUES
            ($user_id, $user_level, '$user_name', '".md5($user_password)."', '$user_email', $user_showemail, $user_allowemails, $user_invisible, $current_time, '$activationkey', $current_time, $current_time, 0, '$user_homepage', '$user_icq', $user_limit".$additional_value_sql.")";
    $result = $site_db->query($sql);


admin/users:
Code: [Select]
 show_input_row($lang['field_icq'], "user_icq", $user_row['user_icq'], $textinput_size);
  show_input_row($lang['field_limit'], "user_limit", $user_row['user_limit']);


admin/settings:
Code: [Select]
 show_setting_row("max_media_size");
  show_setting_row("default_upload_limit");


and the rest were the lang files.
thanks
Title: [Mod] User upload limits
Post by: SLL on February 23, 2003, 10:35:45 PM
Quote from: Bomba
i know that the mod instructions say that we shouldn't do it twice. so what should i do?

no, this couldn't be a reason... you just get this error message, but nothing done with the database, even if you run it twice.

i really don't know what's wrong with your code, the only thing you can be sure - this mod has been installed by number of people sucessfully. so, please try once again with clean backup files.
Title: [Mod] User upload limits
Post by: Bomba on February 23, 2003, 11:11:23 PM
:( did all the changes again and nothing :(
it keeps saying "choose image file"

do i have to chmod any files or something?
you can see this running in http://www.web-fxdesigns.com/4images/index.php it's in portuguese.

i will really need this mod :(
thanks for all your help
Title: [Mod] User upload limits
Post by: SLL on February 23, 2003, 11:28:14 PM
no, you don't have to chmod anything. just the steps described in mod.

i just checked it once again, on fresh 4images installation (now as a daily limit) - it works just fine... so, keep trying  :wink:
Title: [Mod] User upload limits
Post by: V@no on February 23, 2003, 11:28:52 PM
did it actualy worked before "time limit" changes?
Title: [Mod] User upload limits
Post by: Bomba on February 23, 2003, 11:37:31 PM
yes, before this i and the other members were able to upload the pics.

when will it be out the fresh 4images?
Title: [Mod] User upload limits
Post by: SLL on February 23, 2003, 11:41:26 PM
Quote from: Bomba
when will it be out the fresh 4images?

fresh means 4images without any mod applied - i have almost all mods installed on my testsystem, so if something goes wrong, you never know what was the reason  :)
Title: [Mod] User upload limits
Post by: labbishiva on February 27, 2003, 11:49:08 AM
Ich bekomme schon beim ausführen der "install_user_limits.php" folgende Fehlermeldung:

Quote
DB Error: Bad SQL Query: INSERT INTO 4images_settings () VALUES ('default_upload_limit', 7)
You have an error in your SQL syntax near ') VALUES ('default_upload_limit', 7)' at line 2

DB Error: Bad SQL Query: ALTER TABLE 4images_users ADD user_limit SMALLINT(3) DEFAULT 7 NOT NULL
Duplicate column name 'user_limit'


Da ich weder in Englisch noch in PHP über viel Erfahrung verfüge, bringen mir die vorherigen Beiträge nicht so viel  :cry: - vielleicht findet sich ja einer, der es mir au deutsch idiotensicher erklären kann. Wäre super

LG
Nicole

Ach ja über PHPMyAdmin erhalte ich die selber Fehlermeldung, wenn ich den Befehl manuell eingeben will.
Title: [Mod] User upload limits
Post by: SLL on February 27, 2003, 12:57:17 PM
just ignore this error message, it won't influence anything
Title: Small problem with this mod
Post by: lakeside on March 28, 2003, 04:22:03 AM
The problem comes in when you have the admin settings to validate each image.

Thats the way I've got it setup, and when a user is set to 1 image, and admin validates ever image, they can continue to upload images all day long.  Until the admin validates one of the images.

Is there a way around this, besides turning off admin validation?

Thanks
Title: Re: Small problem with this mod
Post by: SLL on March 28, 2003, 08:14:10 AM
Quote from: lakeside
Is there a way around this, besides turning off admin validation?


this came out of my logic when i've made this mod - you don't know if image will be validated or deleted, so it doesn't make much sense to add uploaded image to the user account and check the number of images against this user limits before validation
Title: Re: Small problem with this mod
Post by: lakeside on March 28, 2003, 03:14:07 PM
Quote from: SLL
Quote from: lakeside
Is there a way around this, besides turning off admin validation?


this came out of my logic when i've made this mod - you don't know if image will be validated or deleted, so it doesn't make much sense to add uploaded image to the user account and check the number of images against this user limits before validation


Okay, I can understand that logic, I guess Im not using the mod for what it was intended for.  Im only trying to use it as a way to limit people, because the larger you get the more obnoxious people you get who will upload every image on their hard drive to share, but at the same time you dont know what they are uploading, could be child porn, so validation is the way to go with a public system, but you also dont want them to be able to upload every photo they have to your server.

People respect what you write on a web page, so even if you tell them they are limited to 10 images, but have validation, they will continue to upload many more than 10 images, then you've got the chore of "choosing" which of their images to keep, and which to delete.

Hopefully someone can add onto this mod to incorporate the admin validation feature too.

Thanks for the great mod though.
Title: [Mod] User upload limits
Post by: SLL on March 28, 2003, 03:38:12 PM
well, well, if you're such in trouble  :wink: ...

then do the following:

in member.php find code:
Code: [Select]
$sql = "SELECT image_id FROM ".IMAGES_TABLE." WHERE user_id=$user_id";
$result = $site_db->query($sql);
$images_per_user = $site_db->get_numrows($result);


after add:
Code: [Select]
$sql = "SELECT image_id FROM ".IMAGES_TEMP_TABLE." WHERE user_id=$user_id";
$result = $site_db->query($sql);
$tmp_images_per_user = $site_db->get_numrows($result);

$images_per_user = $tmp_images_per_user + $images_per_user;

this is assuming that you've added original mod already
Title: THANK YOU!
Post by: lakeside on March 28, 2003, 04:23:27 PM
Thank you, works perfectly.  Im not in any trouble yet, but Im more pre-emptively taking care of it before it crops its ugly head.

Great mod made even better!
Title: [Mod] User upload limits
Post by: batz on April 19, 2003, 03:54:59 AM
This MOD works great. But i have one question:

I can't find were i can change individual user limits. In the general settings there is a field to change the limits for all users, when i create a new user there also is a field to change the limits, but for a registred user, when i'm going to edit their settings the limit field doesn't show up.
Any sugestions?

Best Regards
Paulo
Title: [Mod] User upload limits
Post by: lakeside on April 19, 2003, 04:13:50 AM
Sorry, misread the post, I've removed my post as it didnt answer the question properly.
Title: [Mod] User upload limits
Post by: SLL on April 19, 2003, 09:00:38 AM
Quote from: batz
but for a registred user, when i'm going to edit their settings the limit field doesn't show up.

it seems you've missed some mod installation steps. you should see "limits" field in "edit user" form.
Title: [Mod] User upload limits
Post by: SLL on April 19, 2003, 09:07:24 AM
Maybe someone using this mod is missing the tool below (as I did), so I publish it here. This plugin just resetting all users limits to the default gallery setting. You'd need it, for example, if one day you decide to decrease global limit, and doesn't want to edit every existing user afterwards.

Save this code as /admin/plugins/reset_limits.php
Code: [Select]
<?php // PLUGIN_TITLE&#58; Reset User Limits

define&#40;'IN_CP', 1&#41;;
$root_path = &#40;eregi&#40;"\/plugins\/", $PHP_SELF&#41;&#41; ? "./../../" &#58; "./../";
define&#40;'ROOT_PATH', $root_path&#41;;
require&#40;ROOT_PATH.'admin/admin_global.php'&#41;;

if &#40; $action == ""&#41; &#123;
  
$action "modifysettings";
&
#125;

show_admin_header&#40;&#41;;

if &#40;$action == "showsettings"&#41; &#123;

$fldname "user_limit";
$default_limit $config['default_upload_limit'&#93;;

$sql "UPDATE ".USERS_TABLE."
     SET 
$fldname = $default_limit";
    
$site_db->query&#40;$sql&#41;;

  
if &#40;$HTTP_POST_VARS['setting_item'&#93;['language_dir'&#93; != $config['language_dir'&#93;&#41; &#123;
    
printf&#40;"<b>%s</b><p>", $lang['save_settings_success'&#93;&#41;;
    
show_admin_footer&#40;&#41;;
  
&#125;
  
else &#123;
    
$msg sprintf&#40;"<b>%s</b><p>", $lang['save_settings_success'&#93;&#41;;
    
$action "modifysettings";
  &
#125;
&#125;

if &#40;$action == "modifysettings"&#41; &#123;
  
if &#40;isset&#40;$HTTP_GET_VARS['settings_msg'&#93;&#41;&#41; &#123;
    
printf&#40;"<b>%s</b><p>", urldecode&#40;$HTTP_GET_VARS['settings_msg'&#93;&#41;&#41;;
  
&#125;
  
elseif &#40;!empty&#40;$msg&#41;&#41; &#123;
    
echo $msg;
  &
#125;

  
$sql "SELECT setting_name, setting_value
          FROM "
.SETTINGS_TABLE;
  
$result $site_db->query&#40;$sql&#41;;
  
$config = array&#40;&#41;;
  
while &#40;$row = $site_db->fetch_array&#40;$result&#41;&#41; &#123;
    
$config[$row['setting_name'&#93;&#93; = $row['setting_value'&#93;;
  
&#125;

  
show_form_header&#40;"$PHP_SELF", "showsettings"&#41;;
  
show_table_header&#40;"Reset all users upload limit to the default value"&#41;;
  
echo "<tr class=\"tablerow\"><td colspan=\"2\">";
  echo 
"<table border=\"0\" cellpadding=\"3\" cellspacing=\"1\"><tr valign=\"top\">\n";
  echo 
"</tr></table>\n";
  echo 
"<tr class=\"".get_row_bg&#40;&#41;."\">\n<td valign=\"top\"><p class=\"rowtitle\">Default upload limit from Gallery config</p></td>\n";
  
echo "<td>".$config['default_upload_limit'&#93;."<p>";
  
echo "</p></td>\n</tr>\n";

  
show_form_footer&#40;$lang['save_changes'&#93;, "", 2&#41;;
&#125;

show_admin_footer&#40;&#41;;
?>
Title: [Mod] User upload limits
Post by: lakeside on April 27, 2003, 11:28:04 PM
Okay,
Im now wondering if we can't tweak this great mod a bit more..... I know I ask for so much.... And your work is so appreciated.

I have it set to allow each registered user on my site to upload 25 photos (max photo size is 150kb)  But I'd like to offer them unlimited amounts of uploads if they use the url instead of uploading the images to my server.

So, 25 upload images, and unlimited url images.  Do you think this would be possible somehow?

Thanks again for a great mod.  Wish I had the talent to do it myself.  :oops:
Title: [Mod] User upload limits
Post by: SLL on April 28, 2003, 11:26:13 AM
Quote from: lakeside
So, 25 upload images, and unlimited url images.  Do you think this would be possible somehow?

Replace this query:
Quote
$sql = "SELECT image_id FROM ".IMAGES_TABLE." WHERE user_id=$user_id";

With this one:
Quote
$sql = "SELECT image_id, image_media_file FROM ".IMAGES_TABLE." WHERE user_id=$user_id AND image_media_file NOT LIKE '%://%'";

.... then remote images (http, ftp) won't be checked. I believe, this is what you wanted.
Title: Showing time to next upload
Post by: batz on May 08, 2003, 05:30:33 PM
Hi there,

Another great MOD from SSL. Now  :D  is working perfectly.

There is any chance if a user try to upload a photo before 24 hours, if that was the case, and with the warnig message showing a text like this: "You will be able to upload you next photo within xx:xx hours."

This is a request from almost all my users   :)

Thanks again.
Title: [Mod] User upload limits
Post by: SLL on May 08, 2003, 06:18:21 PM
hmm.... sorry, no way for the moment. just edit $lang['no_limits_text'] and write there "... within next 24 hours"  :wink:
Title: [Mod] User upload limits
Post by: Bomba on May 08, 2003, 06:57:17 PM
im using this mod to limit user uploads per day, only x images in every 24 hours.

i would like to know if it's possible to show on the "reached limit message" how many time left to end the 24 hours limit for that user.

thanks
Title: [Mod] User upload limits
Post by: SLL on May 08, 2003, 07:06:48 PM
bomba, you're asking exactly the same question as batz one message above  :roll:
Title: [Mod] User upload limits
Post by: Bomba on May 08, 2003, 07:08:09 PM
oops... you're right... i guess i jumped that last message... sorry.
Title: [Mod] User upload limits
Post by: batz on May 08, 2003, 10:13:58 PM
Thanks anyway SLL.  :)

Bomba: I came first  :P
Title: Re: Showing time to next upload
Post by: SLL on May 13, 2003, 09:10:52 PM
Quote from: batz
There is any chance if a user try to upload a photo before 24 hours, if that was the case, and with the warnig message showing a text like this: "You will be able to upload you next photo within xx:xx hours."

Seems you can do it now  :wink:

Replace the whole function function check_daily_picture_limit with this code:
Code: [Select]
function check_daily_picture_limit($user_id) {
global $site_db, $site_template;

$sql = "SELECT user_limit FROM ".USERS_TABLE." WHERE user_id = $user_id";
$result = $site_db->query($sql);
$row = $site_db->fetch_array($result);
$upload_limit = ($row['user_limit']);
$site_template->register_vars("upload_limit", $upload_limit);

$limit_cutoff = time() - 60 * 60 * 24;

$sql = "SELECT image_id, image_date FROM ".IMAGES_TABLE." WHERE user_id=$user_id AND image_date > $limit_cutoff ORDER BY image_date ASC";
$result = $site_db->query($sql);
$images_per_user = $site_db->get_numrows($result);
$row = $site_db->query_firstrow($sql);
$latest_image_date = ($row['image_date']);

$sql = "SELECT image_id, image_date FROM ".IMAGES_TEMP_TABLE." WHERE user_id=$user_id ORDER BY image_date ASC";
$result = $site_db->query($sql);
$tmp_images_per_user = $site_db->get_numrows($result);
$row = $site_db->query_firstrow($sql);
$latest_tmp_image_date = ($row['image_date']);
$images_per_user = $tmp_images_per_user + $images_per_user;

$latest_image_date = $latest_tmp_image_date > $latest_image_date ? $latest_tmp_image_date : $latest_image_date;
$time_to_go = gmstrftime("%H hrs %M min %S sec", 86400 - (time() - $latest_image_date));

$site_template->register_vars("images_per_user", $images_per_user);
$site_template->register_vars("time_to_go", $time_to_go);

if($images_per_user >= $upload_limit) {
return false;
} else {
return true;
}
}

Then insert {time_to_go} either directly into over_limits.html template or into into $lang['no_limits_text'] in the /lang/main.php. This is assuming that you're using 24 hrs limit, otherwise change 86400 to another figure
Title: [Mod] User upload limits
Post by: batz on May 13, 2003, 10:03:49 PM
What can i say... man, you are the man  :D  This MOD, for me, now is completed. Absolutely great.

Many thanks
Title: [Mod] User upload limits
Post by: Bomba on May 14, 2003, 12:19:10 AM
GREAT!

just one little thing

i don't have
Code: [Select]
function check_daily_picture_limit($user_id) {


what i have is
Code: [Select]
function check_picture_limit($user_id) {

should i copy this new code exactly like u told or should i change it to
Code: [Select]
function check_picture_limit($user_id) { ?

thanks
Title: [Mod] User upload limits
Post by: batz on May 14, 2003, 03:02:22 AM
This is strange, but SLL could tell you better  :wink:
The question is: If you don't have the
Code: [Select]
function check_daily_picture_limit($user_id) { how are you using the User limits MOD?

Search that function above the
Code: [Select]
function check_picture_limit($user_id) {
Title: [Mod] User upload limits
Post by: SLL on May 14, 2003, 08:07:53 AM
Quote from: Bomba
just one little thing
i don't have
Code: [Select]
function check_daily_picture_limit($user_id) {

that means you're using the first version of this mod. you should download the new one and reinstall it.
Title: [Mod] User upload limits
Post by: Bomba on May 15, 2003, 01:03:43 AM
but it works perfectly with daily limit
you told me what should i change to put this daily limit working in page 3 of this topic i think.

what's the difference in this new version?
Title: [Mod] User upload limits
Post by: SLL on May 15, 2003, 08:27:41 AM
Quote from: Bomba
what's the difference in this new version?

Current version has two functions, for both global and daily limits, so you can choose which one to use.
Title: [Mod] User upload limits
Post by: Bomba on May 19, 2003, 05:37:47 PM
do u think that is there any problem if i change my code:

Code: [Select]
function check_picture_limit($user_id) {
   global $site_db, $site_template;

$sql = "SELECT user_limit FROM ".USERS_TABLE." WHERE user_id = $user_id";
$result = $site_db->query($sql);
$row = $site_db->fetch_array($result);
$upload_limit = ($row['user_limit']);
$site_template->register_vars("upload_limit", $upload_limit);

$limit_cutoff = time() - 60 * 60 * 24;

$sql = "SELECT COUNT(*) AS num_rows_all
FROM ".IMAGES_TABLE."
WHERE image_active = 1 AND user_id=$user_id AND image_date > $limit_cutoff";
$row = $site_db->query_firstrow($sql);
$images_per_user = $row['num_rows_all'];

$site_template->register_vars("images_per_user", $images_per_user);

if($images_per_user >= $upload_limit) {
return false;
} else {
return true;
   }
}



to this
Code: [Select]
function check_picture_limit($user_id) {
   global $site_db, $site_template;

$sql = "SELECT user_limit FROM ".USERS_TABLE." WHERE user_id = $user_id";
$result = $site_db->query($sql);
$row = $site_db->fetch_array($result);
$upload_limit = ($row['user_limit']);
$site_template->register_vars("upload_limit", $upload_limit);

$limit_cutoff = time() - 60 * 60 * 24;

$sql = "SELECT image_id, image_date FROM ".IMAGES_TABLE." WHERE user_id=$user_id AND image_date > $limit_cutoff ORDER BY image_date ASC";
$result = $site_db->query($sql);
$images_per_user = $site_db->get_numrows($result);
$row = $site_db->query_firstrow($sql);
$latest_image_date = ($row['image_date']);

$sql = "SELECT image_id, image_date FROM ".IMAGES_TEMP_TABLE." WHERE user_id=$user_id ORDER BY image_date ASC";
$result = $site_db->query($sql);
$tmp_images_per_user = $site_db->get_numrows($result);
$row = $site_db->query_firstrow($sql);
$latest_tmp_image_date = ($row['image_date']);
$images_per_user = $tmp_images_per_user + $images_per_user;

$latest_image_date = $latest_tmp_image_date > $latest_image_date ? $latest_tmp_image_date : $latest_image_date;
$time_to_go = gmstrftime("%H hrs %M min %S sec", 86400 - (time() - $latest_image_date));

$site_template->register_vars("images_per_user", $images_per_user);
$site_template->register_vars("time_to_go", $time_to_go);

if($images_per_user >= $upload_limit) {
return false;
} else {
return true;
    }
}


i use my current code to limit updates by time and it works perfectly, but i would like to add this "how many time to next upload" code in my current mod.
will this work?
Title: [Mod] User upload limits
Post by: SLL on May 19, 2003, 05:44:23 PM
Quote from: Bomba
but i would like to add this "how many time to next upload" code in my current mod.  will this work?

why don't you just try?  :lol:
Title: [Mod] User upload limits
Post by: Bomba on May 19, 2003, 05:45:41 PM
cause im affraid of making some "fatal error" and then i can't solv it  :roll:

 :wink:
Title: [Mod] User upload limits
Post by: V@no on May 19, 2003, 05:48:21 PM
Quote from: Bomba
cause im affraid of making some "fatal error" and then i can't solv it  :roll:

 :wink:
that's why u should do always backup before do any changes... :wink:
Title: [Mod] User upload limits
Post by: bloodhard on May 29, 2003, 09:56:52 AM
hello guys...
i install the mod and followed those steps..
however, when i try to add new user  i got this message..and was unable to add a new user...

i check the code for insert into database ....but i don't have and experience with php connecting mysql ...

andone can help me with this???

thank you so much



DB Error: Bad SQL Query: INSERT INTO 4images_users (user_id, user_level, user_name, user_password, user_email, user_showemail, user_allowemails, user_invisible, user_joindate, user_activationkey, user_lastaction, user_lastvisit, user_comments, user_homepage, user_icq, user_limit) VALUES (8, 2, '123123', '4297f44b13955235245b2497399d7a93', '123123@123.123', 1, 1, 0, 1054193927, '97d77f8fce9b56ea6ca5c3df3c0c54a1', 1054193927, 1054193927, 0, '', '', )


You have an error in your SQL syntax. Check the manual that corresponds to your MySQL server version for the right syntax to use near ')' at line 4
Title: [Mod] User upload limits
Post by: SLL on May 29, 2003, 10:07:04 AM
seems you didn't run the installer, so the neccessary fields were not added to your db
Title: [Mod] User upload limits
Post by: bloodhard on May 29, 2003, 10:15:25 AM
i run the install file....

whcih will add.....a limit field into users table right??
i checked~


or should i run it again~?
Title: [Mod] User upload limits
Post by: Lord Nite on June 17, 2003, 10:03:20 AM
Problem found!

change
Code: [Select]
$sql = "INSERT INTO ".USERS_TABLE."
             (".get_user_table_field("", "user_id").get_user_table_field(", ", "user_level").get_user_table_field(", ", "user_name").get_user_table_field(", ", "user_password").get_user_table_field(", ", "user_email").get_user_table_field(", ", "user_showemail").get_user_table_field(", ", "user_allowemails").get_user_table_field(", ", "user_invisible").get_user_table_field(", ", "user_joindate").get_user_table_field(", ", "user_activationkey").get_user_table_field(", ", "user_lastaction").get_user_table_field(", ", "user_lastvisit").get_user_table_field(", ", "user_comments").get_user_table_field(", ", "user_homepage").get_user_table_field(", ", "user_icq").(", user_limit").$additional_field_sql.")
                 VALUES
              ($user_id, $user_level, '$user_name', '$user_password', '$user_email', $user_showemail, $user_allowemails, $user_invisible, $current_time, '$activationkey', $current_time, $current_time, 0, '$user_homepage', '$user_icq', $user_limit".$additional_value_sql.")";

to this:
Code: [Select]
$sql = "INSERT INTO ".USERS_TABLE."
             (".get_user_table_field("", "user_id").get_user_table_field(", ", "user_level").get_user_table_field(", ", "user_name").get_user_table_field(", ", "user_password").get_user_table_field(", ", "user_email").get_user_table_field(", ", "user_showemail").get_user_table_field(", ", "user_allowemails").get_user_table_field(", ", "user_invisible").get_user_table_field(", ", "user_joindate").get_user_table_field(", ", "user_activationkey").get_user_table_field(", ", "user_lastaction").get_user_table_field(", ", "user_lastvisit").get_user_table_field(", ", "user_comments").get_user_table_field(", ", "user_homepage").get_user_table_field(", ", "user_icq").(", user_limit").$additional_field_sql.")
                 VALUES
              ($user_id, $user_level, '$user_name', '$user_password', '$user_email', $user_showemail, $user_allowemails, $user_invisible, $current_time, '$activationkey', $current_time, $current_time, 0, '$user_homepage', '$user_icq', '$user_limit'".$additional_value_sql.")";


Notice the ' around the $user_limit string.  It wasn't there before, and that would cause the errors.  I just discovered this fix by testing on my own live board.

Ah, the joy one gets when he figures out the problem all on his own with absolutely no PHP knowledge.  :P
Title: [Mod] User upload limits
Post by: SLL on June 17, 2003, 11:34:07 AM
Quote from: Lord Nite
Notice the ' around the $user_limit string.  It wasn't there before, and that would cause the errors.

hmm... this db field is smallint(3), so why you need to quote it? moreover, neither i do not get any error messages at my site, nore anybody else reported such bug
Title: [Mod] User upload limits
Post by: Lord Nite on June 17, 2003, 01:01:00 PM
Well, I know that this is what caused my board to error when adding a user from the admin panel.

It might not have actually fixed it, but it did provide a decent workaround.
Title: [Mod] User upload limits
Post by: SLL on June 17, 2003, 04:33:35 PM
Quote from: Lord Nite
error when adding a user from the admin panel

ah.. that one was fixed long time ago.  and it was caused by wrong icq field
Title: [Mod] User upload limits
Post by: Lord Nite on June 17, 2003, 08:23:03 PM
Please explain.
Title: [Mod] User upload limits
Post by: migraul on June 20, 2003, 12:45:19 PM
I would like to indicate the limit in the Memberprofil the user.  What
there do I have to make?
Title: [Mod] User upload limits
Post by: SLL on June 20, 2003, 04:17:33 PM
you can see in lang\main.php >
Code: [Select]
$lang['already_loaded'] = "<span class=\"smalltext\"><b>For your information:</b> you have uploaded <b>{images_per_user}</b> images out of <b>{upload_limit}</b> allowed for you.</span>";

so, use {images_per_user} and {upload_limit} in your member profile template
Title: [Mod] User upload limits
Post by: migraul on June 20, 2003, 04:29:51 PM
sorry, does not function.  it is indicated nothing!
Title: [Mod] User upload limits
Post by: SLL on June 20, 2003, 05:51:43 PM
:?  this vars registred with over_limits.html template only... sorry, i can't tell you for the moment how to use it in profile
Title: Re: [Mod] User upload limits
Post by: tikle on March 24, 2005, 09:16:28 PM
hallo

was soll ich machen damit es auch mit phpBB funktioniert?

danke im Vorraus
Title: Re: [Mod] User upload limits
Post by: tikle on April 11, 2005, 01:04:59 AM
kann mir Jemand helfen?
ein kleiner Tip were genügend ;)
danke
Title: Re: [Mod] User upload limits
Post by: Towerade on June 13, 2005, 03:16:58 PM
Is this MOD compatible with the integration phpBB & 4images?????? (the users table is the phpBB´s table)
http://www.4homepages.de/forum/index.php?topic=1658.300

Thx
Title: Re: [Mod] User upload limits
Post by: Lucifix on June 23, 2005, 04:07:53 PM
I don't know if anyone else noticed this, but I have set limit, so that members can upload 1 image on 48 hours. But you can cheat here!

When you upload image, you click BACK button and you will be able to upload as many image you would like.

Saidly I didn't solved that problem, but would be very glad if only else does it ;)
Title: Re: [Mod] User upload limits
Post by: V@no on June 24, 2005, 01:13:33 AM
try to insert 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;
  }
This block:
Code: [Select]
  if (!check_picture_limit($user_info['user_id'])){
  // if (!check_daily_picture_limit($user_info['user_id'])) {
 
  //
  // Depending on your requirements, you can either check against global or daily limit. For global check leave it as it is now.
  // For daily limit comment first line and uncomment second one.
  //
 
  $site_template->print_template($site_template->parse_template("over_limit"));
  include(ROOT_PATH.'includes/page_footer.php');
  exit;
  }

If u get an error message "call underfined function" then move function check_picture_limit($user_id){...} and function check_daily_picture_limit($user_id) {...} into includes/functions.php
Title: Re: [Mod] User upload limits
Post by: Lucifix on June 24, 2005, 12:33:12 PM
Actualy I get this msg:

Parse error: parse error, unexpected ')' in /home/.../member.php on line 504

Line 504:   
Code: [Select]
if (!check_daily_picture_limit($user_info['user_id']))) {
Title: Re: [Mod] User upload limits
Post by: V@no on June 24, 2005, 02:23:19 PM
sorry, remove one ")" from that line. (I've updated my post)
Title: Re: [Mod] User upload limits
Post by: Lucifix on June 30, 2005, 07:39:38 AM
I have installed daily limit, but after few months I'm getting this error:


Code: [Select]
when I or any other member is trying to upload image in gallery we get this error:
DB Error: Bad SQL Query: SELECT user_limit FROM 4images_users WHERE user_id =
You have an error in your SQL syntax. Check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 1
 
DB Error: Bad SQL Query: SELECT COUNT(*) AS num_rows_all FROM 4images_images WHERE image_active = 1 AND user_id= AND image_date > 1119087504
You have an error in your SQL syntax. Check the manual that corresponds to your MySQL server version for the right syntax to use near 'AND image_date > 1119087504' at line 3
Image added: test Luc (1312686213.jpg)

http://www.4homepages.de/forum/index.php?topic=8553
Title: Re: [Mod] User upload limits
Post by: Egly on July 28, 2005, 03:40:26 PM
I have installed this mod successful and it works nearly perfekt.
The only thing that wont work is the upload limit when i havent validated the photos.
The users can upload as long and as much as they want if i havent validated their pictures.

Yes, i have uncommented the four lines like it stands in the tut.

It would be great, if someone could help me..
Title: Re: [Mod] User upload limits
Post by: asomy1 on August 03, 2005, 01:11:43 AM
ich habe den mod nach anleitung installiert und es scheint auch alles zu klappen. keine fehlermeldung und  bei überschreiten des limits wird eine fehlermeldung ausgegeben mit dem hinweis auf das limit.

nur werden die variablen {images_per_user} und {upload_limit} aus der lang\xxx\main.php nicht angezeigt.
d.h. der hinweistext erscheint, jedoch werden die im ACP eingesetzten limit-werte hier nicht ausgegeben. der user kann also nicht erkennen, wie hoch sein limit ist.

wo liegt der fehler, bzw habe ich etwas bei der installation übersehen?
danke im voraus  8)

Quote
i installed this mod and it works fine. unfortunately the variable {images_per_user} and {upload_limit} are not shown in the text. they seemed to be ignored.
what's the problem? did i make a mistake while installing the mod?
thanks in advance  8)
Title: Re: [Mod] User upload limits
Post by: asomy1 on August 04, 2005, 11:24:29 AM
hat niemand eine idee?
habe die anleitung nochmal durchgelesen, sehe allerdings keinen fehler  8O

Quote
any ideas?
i read the manual again, but don't see any errors.

Title: Re: [Mod] User upload limits
Post by: asomy1 on August 08, 2005, 06:55:54 PM
is there still any support for this mod ?
Title: Re: [Mod] User upload limits
Post by: V@no on August 09, 2005, 12:31:32 AM
is there still any support for this mod ?

perhaps you didnt know that the author of this mod does not speak deutsch...
Title: Re: [Mod] User upload limits
Post by: asomy1 on August 09, 2005, 08:45:46 AM
is there still any support for this mod ?

perhaps you didnt know that the author of this mod does not speak deutsch...

I assumed that,
and that's why I wrote in german & english.  :wink:

and I saw the last posts of users unanswered, although they wrote in english.   :(
Title: Re: [Mod] User upload limits
Post by: asomy1 on August 14, 2005, 08:24:40 PM
hmm, thanks anyway
Title: Re: [Mod] User upload limits
Post by: dosensteck on October 01, 2005, 10:25:54 PM
i found here (http://faces.dalnet.ru/files.php?l=english) only the version 1.1 - where can i found the version 1.2?

Title: Re: [Mod] User upload limits
Post by: dosensteck on October 04, 2005, 04:53:36 PM
ok, hat irgendjemand noch die zip datei und kann sie mir schicken? dosensteck@chello.at

wäre wirklich super :)

Title: Re: [Mod] User upload limits
Post by: beseech on October 11, 2005, 03:13:34 AM
how make it work like set a limit of 1pic for user , but user can only upload 1 pic in 4day in 4 days ?

upload 1 pic .... user can upload 4 days after ....

:) cheers
Title: Re: [Mod] User upload limits
Post by: NTH on October 11, 2005, 08:49:08 PM
Hi!
My problem : I installed tihs mod.
The users, when registred after the mod install, the mod doesen't work, olny the old users.
Title: Re: [Mod] User upload limits
Post by: V@no on October 12, 2005, 01:34:13 AM
My problem : I installed tihs mod.
if that's the problem, then you'd better uninstall it ;) (sorry sarcastic-bad joke :P)

The users, when registred after the mod install, the mod doesen't work, olny the old users.
anyone understud what is the problem? I didnt...please explain.
Title: Re: [Mod] User upload limits
Post by: NTH on October 12, 2005, 06:32:15 AM
 :D :D

Sorry. I don't speak english.

The upload limit doesen't work the new users, only the old users.
What's the result?
Title: Re: [Mod] User upload limits
Post by: V@no on October 12, 2005, 07:26:40 AM
I think its a bug...
Remove all changes from register.php (ok, it will work even if you leave them ;))

Then find:
Code: [Select]
    $additional_value_sql = "";Insert below:
Code: [Select]
    $HTTP_POST_VARS['user_limit'] = $config['default_upload_limit'];
Title: Re: [Mod] User upload limits
Post by: NTH on October 12, 2005, 08:13:08 PM
Re

I insert the code,the register.php but don't happend enything.
Title: Re: [Mod] User upload limits
Post by: spellchecker on October 13, 2005, 12:10:44 AM
anyone understud what is the problem? I didnt...please explain.

"underSTUD"?

from www.dict.org:

stud
       n 1: a man who is virile and sexually active [syn: he-man, macho-man]

I don't even want to guess with what you mean with your "under a stud" remark. sounds gay.

Title: Re: [Mod] User upload limits
Post by: V@no on October 13, 2005, 02:00:04 AM
spellchecker, your comment has nothing to do with the topic, next time either PM directly to the person with your spelling corrections, or post it in chit-chat forum, in fact next time provide the correct spelling as well (unless ofcourse being an @$$ is your nature - based on your comments and actions on my site).

@NTH:
How do u check that it doesnt work? did u try edit a member and see if they have the upload limit value set as in config?
Title: Re: [Mod] User upload limits
Post by: NTH on October 13, 2005, 07:18:23 AM
I edit the upload limit the users the control panel, but doesen't work.

When I reinstall the  install_user_limits.php  this error messeage viewed.

DB Error: Bad SQL Query: INSERT INTO 4images_settings () VALUES ('default_upload_limit', 5)
Duplicate entry 'default_upload_limit' for key 1

DB Error: Bad SQL Query: ALTER TABLE 4images_users ADD user_limit SMALLINT(3) DEFAULT 5 NOT NULL
Duplicate column name 'user_limit'
Title: Re: [Mod] User upload limits
Post by: V@no on October 13, 2005, 08:01:00 AM
I still dont understand what EXACTLY doesnt work?
Title: Re: [Mod] User upload limits
Post by: Acidgod on October 13, 2005, 12:01:59 PM
When I reinstall the  install_user_limits.php  this error messeage viewed.

DB Error: Bad SQL Query: INSERT INTO 4images_settings () VALUES ('default_upload_limit', 5)
Duplicate entry 'default_upload_limit' for key 1

DB Error: Bad SQL Query: ALTER TABLE 4images_users ADD user_limit SMALLINT(3) DEFAULT 5 NOT NULL
Duplicate column name 'user_limit'

This puts new Fields in your DB and when you call it two times this error will come...

Specify your questions, what exact is going wrong?
Title: Re: [Mod] User upload limits
Post by: NTH on October 13, 2005, 07:16:51 PM
I still dont understand what EXACTLY doesnt work?

The upload limit the new users.
Title: Re: [Mod] User upload limits
Post by: spellchecker2 on October 13, 2005, 09:47:20 PM
spellchecker, your comment has nothing to do with the topic, next time either PM directly to the person with your spelling corrections, or post it in chit-chat forum, in fact next time provide the correct spelling as well (unless ofcourse being an @$$ is your nature - based on your comments and actions on my site).


Sure.. and vano, your site and it's non-working ban mod have nothing to do with this site. Touché. (ok, better forget the "touché" part, i bet you're too ignorant to even grasp its meaning)

 - correct spelling is  "underSTOOD". Like any kid could tell you.

 - Just because you're a russian in the middle of a site full of germans, that does not mean that you should try to act as a homo/xeno fobic nazi. So just stay quietly in the corner and remember that you ARE an illiterate bastard who is a great coder, but are not humble enough to admit your english skills are as bad as from a 5 year old kid.

Title: Re: [Mod] User upload limits
Post by: V@no on October 14, 2005, 12:22:19 AM
- Just because you're a russian in the middle of a site full of germans, that does not mean that you should try to act as a homo/xeno fobic nazi. So just stay quietly in the corner and remember that you ARE an illiterate bastard who is a great coder, but are not humble enough to admit your english skills are as bad as from a 5 year old kid.
Well, obviosly your english is not great either, since it seems u dont understand when I've told you not to reply to the topics with something not related to the subject.
As of "but are not humble enough to admit your english skills are as bad as from a 5 year old kid." where did this came up? Please show me where I ever said "my english is perfect" or "my english is better then yours"? Man, you have issues...really...
As of "act as a homo/xeno fobic nazi" I've never met such people, I have no idea what that means, but u must have lots experience with them...and since you have brought up nationalities - whos a nazi here then?
Grow up and act as a mature!

P.S. U still didnt give me an answer why do u visit my site every day if you dont like it? :roll:

@NTH:
"Doesnt work" is not helping us, we need descriptions of the steps u do to test it, more details!
Title: Re: [Mod] User upload limits
Post by: Acidgod on October 14, 2005, 02:44:39 PM
and since you have brought up nationalities - whos a nazi here then?

Sorry, but why are People with german nationalities nazis?  8O
In each nationalities gives nazis....
And please don´t blame us with our History and think about Stalin when you saying that...
I think and hope you where angry when you writing the Posting!

Sorry for the Offtopic!

Title: Re: [Mod] User upload limits
Post by: V@no on October 14, 2005, 02:49:32 PM
and since you have brought up nationalities - whos a nazi here then?

Sorry, but why are People with german nationalities nazis? 8O
In each nationalities gives nazis....
And please donґt blame us with our History and think about Stalin when you saying that...
I think and hope you where angry when you writing the Posting!

Sorry for the Offtopic!


I dont think you understOOd what I said, I didnt not mention any nation in specific, in fact, my reply was specificaly for spellchecker personaly, individualy, he/she's the one who brough up the nationalities in the issue and call up nazi.
Title: Re: [Mod] User upload limits
Post by: SLL on October 15, 2005, 10:03:06 AM
but are not humble enough to admit your english skills are as bad as from a 5 year old kid.

spellcheck this, asshole...

(http://rulezman.multik.org/62.gif)
Title: Re: [Mod] User upload limits
Post by: NTH on October 16, 2005, 11:41:21 AM
:)
The script very good...but I discovered 1 bug.
When I upload images this link   /member.php?action=uploadform    the upload limit script doesn't work.  :roll:
The script only work, if I upload the images to the categories.
What's the result.
Title: Re: [Mod] User upload limits
Post by: Lucifix on November 03, 2005, 03:11:50 PM
Who can help me solve that problem?

In my gallery when you upload photo you'll get these errors:

Code: [Select]

DB Error: Bad SQL Query: SELECT user_limit FROM 4images_users WHERE user_id =
You have an error in your SQL syntax. Check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 1

DB Error: Bad SQL Query: SELECT COUNT(*) AS num_rows_all FROM 4images_images WHERE image_active = 1 AND user_id = AND image_date > 1130853879
You have an error in your SQL syntax. Check the manual that corresponds to your MySQL server version for the right syntax to use near 'AND image_date > 1130853879' at line 3

I check my code but everything seemse OK:
Code: [Select]
function check_daily_picture_limit($user_id) {
global $site_db, $site_template;

$sql = "SELECT user_limit FROM ".USERS_TABLE." WHERE user_id = $user_id";
$result = $site_db->query($sql);
$row = $site_db->fetch_array($result);
$upload_limit = ($row['user_limit']);
$site_template->register_vars("upload_limit", $upload_limit);


$limit_cutoff = time() - 60 * 60 * 48;

$sql = "SELECT COUNT(*) AS num_rows_all
FROM ".IMAGES_TABLE."
WHERE image_active = 1 AND user_id = $user_id AND image_date > $limit_cutoff";
$row = $site_db->query_firstrow($sql);
$images_per_user = $row['num_rows_all'];

$site_template->register_vars("images_per_user", $images_per_user);

if($images_per_user >= $upload_limit) {
return false;
} else {
return true;
}
}

If you check that error carfuly you'll see that user_id is the problem. But I triend to insert

Code: [Select]
echo $user_id;
 just before $sql and it shows my ID correct.

Please help me with these one, couse I just can't solve it!
Title: Re: [Mod] User upload limits
Post by: Darkness2001 on November 21, 2005, 06:25:52 PM
Hello,

HELP..... I destroy my 4images_settings data and I dont have a Update for this file, pleas give me the code for the table...  :oops:

CREATE TABLE '4images_settings' .... ????

Greez Darkness
Title: Re: [Mod] User upload limits
Post by: V@no on November 22, 2005, 02:50:52 AM
Run the installer again. Also, would not hurt open the instructions again, its all there ;)

Code: [Select]
INSERT INTO `4images_settings` (`setting_name`, `setting_value`) VALUES ('default_upload_limit', '5');
Title: Re: [Mod] User upload limits
Post by: Darkness2001 on November 22, 2005, 11:26:03 AM
Hello and thanks V@no

allready is running  :mrgreen:

Greez Darkness
Title: Re: [Mod] User upload limits
Post by: JensF on January 15, 2006, 12:30:14 AM
I thing this is a great Mod but it doesn´t work for me :(

I have set the limits to 1 to test the function. I log In as a User a Upload the first Pic. OK! Now i will upload the second Pic and i can do it. No error message, no Info. I can Upload.....

When must i see the over_limit.html???

Befor i will upload the second Pic???
Title: Re: [Mod] User upload limits
Post by: bacterio on January 15, 2006, 10:57:40 PM
I put the upload daily limit, but doesen't work.  :roll:

Only work upload image from category, not from: http://mypage.com/member.php?action=uploadform

Title: Re: [Mod] User upload limits
Post by: Joss on January 18, 2006, 03:15:00 PM
Hello!

This is a one of usefull mod. But I have a question. I need modification of this mod: I want to decrease the daily limit for users, who didn't participated in voting within a week. It's possible to do it?
Title: Re: [Mod] User upload limits
Post by: Hobit on January 19, 2006, 10:11:29 PM
Frage

Kriegt man den User upload limits auch in deutsch?    Bin der englischen Sprache nicht so mächtig



Danke

Title: Re: [Mod] User upload limits
Post by: Hannibal on March 11, 2006, 11:18:55 AM
Hello. I have a one question:
Is the possibility settings of the upload limit for images, like this, so that counted he again of every day and not from the time upload of the last image?
Title: Re: [Mod] User upload limits
Post by: Q-man on March 18, 2006, 06:53:29 PM
Bei mir funzt das auch nicht...es gibt keine Fehlermeldungen aber ich kann wenn ich das Limit auf 1 gesetzt habe soviele Fotos hochladen wenn ich will. Habe um das zu testen extra einen test account aufgemacht (registrierter user)
--------------------------------------------------------------

It doesnt work for me...there isnt any error message and users still can upload how much they want
Please help me!

thx
Q

Title: Re: [Mod] User upload limits
Post by: Grutho on April 02, 2006, 12:03:38 PM
Hallo,

habe genau das gleiche Problem. Hat dafür schon jemad eine Lösung gefunden?

Hi,

have exactly the same problem. Have anyone a solution for fix that problem?

Best regars,
Tom


ich habe den mod nach anleitung installiert und es scheint auch alles zu klappen. keine fehlermeldung und  bei überschreiten des limits wird eine fehlermeldung ausgegeben mit dem hinweis auf das limit.

nur werden die variablen {images_per_user} und {upload_limit} aus der lang\xxx\main.php nicht angezeigt.
d.h. der hinweistext erscheint, jedoch werden die im ACP eingesetzten limit-werte hier nicht ausgegeben. der user kann also nicht erkennen, wie hoch sein limit ist.

wo liegt der fehler, bzw habe ich etwas bei der installation übersehen?
danke im voraus  8)

Quote
i installed this mod and it works fine. unfortunately the variable {images_per_user} and {upload_limit} are not shown in the text. they seemed to be ignored.
what's the problem? did i make a mistake while installing the mod?
thanks in advance  8)
Title: Re: [Mod] User upload limits
Post by: Nasser on April 15, 2006, 08:29:09 PM
hello ..
when I start to run DB Error:


install_user_limits.php

I've got this error ..

what does it mean and what should I do please?

 Bad SQL Query: INSERT INTO 4images_settings () VALUES ('default_upload_limit', )
You have an error in your SQL syntax. Check the manual that corresponds to your MySQL server version for the right syntax to use near ')' at line 4

DB Error: Bad SQL Query: ALTER TABLE 4images_users ADD user_limit SMALLINT(3) DEFAULT NOT NULL
You have an error in your SQL syntax. Check the manual that corresponds to your MySQL server version for the right syntax to use near 'NOT NULL' at line 2
Title: Re: [Mod] User upload limits
Post by: V@no on April 16, 2006, 03:05:09 AM
I've attached a fixed version of the installer in the original topic, please use that one.
Title: Re: [Mod] User upload limits
Post by: Nasser on April 17, 2006, 02:25:22 AM
it's working .. thank you
Title: Re: [Mod] User upload limits
Post by: Towerade on May 02, 2006, 01:00:48 PM
How can i allow only a group of users. I administrated a group in phpbb and 4images but i cant allow it to submit photos.  :(
Title: Re: [Mod] User upload limits
Post by: oboda on May 11, 2006, 07:38:08 PM
i installed this mod and it works fine. unfortunately the variable {images_per_user} and {upload_limit} are not shown in the text. they seemed to be ignored.
what's the problem?
Ii have check many times the tutorial and i hanve't done any mistake... i guess.. someone help me please.
Title: Re: [Mod] User upload limits
Post by: oboda on May 27, 2006, 02:00:36 PM
I cant suggest the mod, because no one can help us and i dont know why, the mod dont work...
Whatever...
Title: Re: [Mod] User upload limits
Post by: jotabonfim on June 15, 2006, 12:55:07 AM
I am trying to erase an user by the control panel and do not get! It appears this message
please help my

my 4images is 1.7.2

Fatal error: Call to undefined function slashes() in /home/restricted/home/xxxxxx/public_html/site/admin/users.php on line 34
Title: Re: [Mod] User upload limits
Post by: V@no on June 15, 2006, 01:37:07 AM
Restore admin/users.php from backups and try again, you made a misstake somewhere in the code.
Title: Re: [Mod] User upload limits
Post by: mstgokcen on July 24, 2006, 02:33:57 PM
in the 23th post you say use this code for 24hours limit...

Code: [Select]
function check_picture_limit($user_id) {
global $site_db, $site_template;

$sql = "SELECT user_limit FROM ".USERS_TABLE." WHERE user_id = $user_id";
$result = $site_db->query($sql);
$row = $site_db->fetch_array($result);
$upload_limit = ($row['user_limit']);
$site_template->register_vars("upload_limit", $upload_limit);

$limit_cutoff = time() - 60 * 60 * 24;

$sql = "SELECT COUNT(*) AS num_rows_all
FROM ".IMAGES_TABLE."
WHERE image_active = 1 AND user_id=$user_id AND image_date > $limit_cutoff";
$row = $site_db->query_firstrow($sql);
$images_per_user = $row['num_rows_all'];

$site_template->register_vars("images_per_user", $images_per_user);

if($images_per_user >= $upload_limit) {
return false;
} else {
return true;
}
}

then in the 60th post now you say:

change it
Code: [Select]
function check_daily_picture_limit($user_id) {
global $site_db, $site_template;

$sql = "SELECT user_limit FROM ".USERS_TABLE." WHERE user_id = $user_id";
$result = $site_db->query($sql);
$row = $site_db->fetch_array($result);
$upload_limit = ($row['user_limit']);
$site_template->register_vars("upload_limit", $upload_limit);

$limit_cutoff = time() - 60 * 60 * 24;

$sql = "SELECT image_id, image_date FROM ".IMAGES_TABLE." WHERE user_id=$user_id AND image_date > $limit_cutoff ORDER BY image_date ASC";
$result = $site_db->query($sql);
$images_per_user = $site_db->get_numrows($result);
$row = $site_db->query_firstrow($sql);
$latest_image_date = ($row['image_date']);

$sql = "SELECT image_id, image_date FROM ".IMAGES_TEMP_TABLE." WHERE user_id=$user_id ORDER BY image_date ASC";
$result = $site_db->query($sql);
$tmp_images_per_user = $site_db->get_numrows($result);
$row = $site_db->query_firstrow($sql);
$latest_tmp_image_date = ($row['image_date']);
$images_per_user = $tmp_images_per_user + $images_per_user;

$latest_image_date = $latest_tmp_image_date > $latest_image_date ? $latest_tmp_image_date : $latest_image_date;
$time_to_go = gmstrftime("%H hrs %M min %S sec", 86400 - (time() - $latest_image_date));

$site_template->register_vars("images_per_user", $images_per_user);
$site_template->register_vars("time_to_go", $time_to_go);

if($images_per_user >= $upload_limit) {
return false;
} else {
return true;
}
}


then in 63rd post someone says

 If you don't have the
Code: [Select]
function check_daily_picture_limit($user_id) {
how are you using the User limits MOD?



of course there is no such code because in the 23rd post another said change it...

Now I am completely confused finally it doesnt work bu I dont know why I lost in somewhere in codes...
At the first it was working 1 photo for 1 user and then program said there is no limit call admin etc... then I put changings and then and then and then now I 'm lost..


moreover in somewhere u say change the whole code but in orginal code there were more lines...

 will those lines will stay or remove at the end ?

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;
 }

if ($cat_id != 0 && (!isset($cat_cache[$cat_id]) || !check_picture_limit($user_id))) {
// if ($cat_id != 0 && (!isset($cat_cache[$cat_id]) || !check_daily_picture_limit($user_id))) {

//
// Depending on your requirements, you can either check against global or daily limit. For global check leave it as it is now.
// For daily limit comment first line and uncomment second one.
//

$site_template->print_template($site_template->parse_template("over_limit"));
include(ROOT_PATH.'includes/page_footer.php');
exit;
}
Title: Re: [Mod] User upload limits
Post by: mstgokcen on July 27, 2006, 03:26:25 PM
I'm lost in codes

is there anyone can send the codes which is exactly the final codes for the 24hours limit and explain exactly where I paste  the codes
Title: Re: [Mod] User upload limits
Post by: jafori on August 06, 2006, 08:45:37 PM
I have an question
can i make a specific upload limit for a few members without effecting the rest without using this MOD? I mean like trixing with db or control panel?
If yes, please tell me how...

My second question:
Can i make an upload limit for a specific category and its subcategories and when someone upload files in other categories, those uploads wont be count in the limit? If yes, please tell me how..

:) thanks
Title: Re: [Mod] User upload limits
Post by: jafori on August 08, 2006, 08:58:03 PM
ooh =( no ansers.... better go to bed and cry out =).. or maybe hit my head on the wall till i get an idea =)

thanks for reading my comment thoe :P
Title: Re: [Mod] User upload limits
Post by: Stoleti on August 25, 2006, 10:33:53 PM
i like this but , i'm looking for it:

=> Not limited by time , but yes by number of pic's
=> Normal users 10 pic's
=> admin 25 pic's

how make it , without time limites ??
Title: Re: [Mod] User upload limits
Post by: jotabonfim on October 07, 2006, 10:17:00 PM
HI knows the reply for this question? 

http://www.4homepages.de/forum/index.php?topic=3607.msg57337#msg57337
Title: Re: [Mod] User upload limits
Post by: Cipriano on December 14, 2006, 01:36:41 PM
Hi, does anyone have this mod in full working? If yes could you send me a pm where to download it?
Title: Re: [Mod] User upload limits
Post by: Mickman on January 02, 2007, 07:38:10 AM
i installed this mod and it works fine. unfortunately the variable {images_per_user} and {upload_limit} are not shown in the text. they seemed to be ignored.
what's the problem?
Ii have check many times the tutorial and i hanve't done any mistake... i guess.. someone help me please.

Ich habe das gleiche Problem. Gibt es dafür eine Lösung?

Danke,
Michael
Title: Re: [Mod] User upload limits
Post by: Ferus on January 04, 2007, 02:09:25 PM
Hello, i have n00b question.
Where is instruction for install this mod?
In install pack are not exist.
Please help me, Ferus
Title: Re: [Mod] User upload limits
Post by: qpatrick on March 05, 2007, 01:54:18 PM
:)
The script very good...but I discovered 1 bug.
When I upload images this link   /member.php?action=uploadform    the upload limit script doesn't work.  :roll:
The script only work, if I upload the images to the categories.
What's the result.

Is this a confirmed bug ? I noticed that a user of my site uploaded to many pictures. I don't know how that could be. Maybe this is the same bug as mentioned above....
How could we solve this problem ?

Thankx in advance !

Patrick
Title: Re: [Mod] User upload limits
Post by: jotabonfim on March 09, 2007, 12:57:15 AM
:)
The script very good...but I discovered 1 bug.
When I upload images this link   /member.php?action=uploadform    the upload limit script doesn't work.  :roll:
The script only work, if I upload the images to the categories.
What's the result.

Is this a confirmed bug ? I noticed that a user of my site uploaded to many pictures. I don't know how that could be. Maybe this is the same bug as mentioned above....
How could we solve this problem ?

Thankx in advance !

Patrick


Hi! obtained to discover as to correct this bug?

please help me!!!!  this problem this affecting my site!  
Title: Re: [Mod] User upload limits
Post by: jotabonfim on March 10, 2007, 11:59:24 PM
I discovered plus one bug in this module, it I am incompatible with version 1.7.4 !
Title: [Mod] User upload limits
Post by: jotabonfim on March 20, 2007, 06:22:51 PM
Hi all has some reply for this!

I am made use to pay to have this module functioning correctly. :oops:
Title: Re: [Mod] User upload limits
Post by: jotabonfim on April 18, 2007, 05:36:27 PM
help!!!!! :cry: :cry: :cry:
Title: Re: [Mod] User upload limits
Post by: jotabonfim on April 26, 2007, 02:38:45 PM
help!!!!! :cry: :cry: :cry:
????
Title: Re: [Mod] User upload limits
Post by: CeJay on April 27, 2007, 08:37:14 AM
help!!!!! :cry: :cry: :cry:
????

Try making a request in Requests for paid modifications / Jobbörse (http://www.4homepages.de/forum/index.php?board=26.0) instead of just bumping this thread.
Title: Re: [Mod] User upload limits
Post by: ttluan on October 25, 2007, 05:13:47 PM
Hi anybody,
Does this mod work fine in v1.74 ?
Title: Re: [Mod] User upload limits
Post by: Valery on January 04, 2008, 06:31:06 PM
Good day!
How to make the general limit to the user accaunt in Mb? For example 20 or 30Mb ..... or other?
Title: Re: [Mod] User upload limits
Post by: darkcurves on March 03, 2008, 05:14:18 AM
I get this DB error. Is it compatible with 1.7.4? Are there any other alternative upload limit script?

Quote
DB Error: Bad SQL Query: INSERT INTO 4images_settings () VALUES ('default_upload_limit', )
You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ')' at line 4

DB Error: Bad SQL Query: ALTER TABLE phpbb_users ADD user_limit SMALLINT(3) DEFAULT NOT NULL
You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'NOT NULL' at line 2
Title: Re: [Mod] User upload limits
Post by: Sunny C. on March 29, 2008, 02:48:25 AM
Das läuft aber nicht mit der aktuellebn Version oder?

Ich habe die Dateien angepasst wie beschrieben (Und ja ich kann das, ist nur Copy&Paste und ich habe mehrere CMS System mit Plugins und Mods bestückt), dennoch klappt es nicht! Im Mysql steht das dass Limit auf 3 wäre, wenn ich aber die Install erneut ausführen will, kommt:

Quote
An unexpected error occured. Please try again later.

An unexpected error occured. Please try again later.

Was kann ich tun?

http://www.4homepages.de/forum/index.php?topic=20997.new#new
Title: Re: [Mod] User upload limits
Post by: crimea on May 21, 2008, 06:26:46 AM
It does not works with 1.7.6 version.... :(
Title: Re: [Mod] User upload limits
Post by: Sunny C. on June 16, 2008, 12:30:06 AM
Ist es möglich das man das Upload-Limit in der 1.7.6 auch begrenzen kann? Im phpmyadmin steht es bei mir auf 4, dennoch können die User mehr hochladen!
Title: Re: [Mod] User upload limits
Post by: Jan-Lukas on June 16, 2008, 07:46:01 AM
Diesen Mod verstehe ich nicht, warum begrenzt jemand das hochladen  :?:
Seit ihr nicht froh, wenn sich eure Galerie füllt  :wink:
Title: Re: [Mod] User upload limits
Post by: Sunny C. on June 16, 2008, 09:29:21 AM
Nicht wenn man was anderes mit der Gallery vor hat wie z.B Eine FotoGallery! Daher möchte ich gerne bzw. auch andere wissen, wie das geht das dies auch begrenzt wird! Obwohl eingestellt ist auf "4" können die User mehr hochladen!
Title: Re: [Mod] User upload limits
Post by: Jan-Lukas on June 16, 2008, 12:05:41 PM
Das hab ich schon verstanden ;) wird sich etwas nicht vertragen, oder hat sich ein Fehler eingenistet.
Hab das gleiche mit der multi Lightbox, ist auf 10 Kategorien eingestellt, aber man kann unendliche einrichten, bin noch nicht dahinter gekommen, wo der Fehler liegt.
Title: Re: [Mod] User upload limits
Post by: Sunny C. on June 16, 2008, 12:12:48 PM
Ich habe ja die Mod also das Upload-Limit erst hinterher verwendet, weil ich dachte das es manuell nicht ginge! Also beides das gleiche Resultat! Wofür ist das denn dann da? Also das wäre schon mal nicht schlecht wenn das geht!

Ich habs mal mit aufgenommen:
http://www.4homepages.de/forum/index.php?topic=21850.msg119059#msg119059
Title: Re: [Mod] User upload limits 1.7.6
Post by: jotabonfim on June 21, 2008, 12:12:05 AM
Hello friends of the forum, I have a problem with this module that is already 2 years. I discovered a bug in this module and unfortunately could not find solution to this problem.
My question is?
This module works correctly?
It works with current version 1.7.6?
The module that is sold here in the forum, also does not work!.
I am grateful if someone respond. :D


BUG: /member.php?action=uploadform
Title: Re: [Mod] User upload limits
Post by: Sunny C. on July 06, 2008, 08:18:07 PM
Ich würde gerne wissen wie das nun möglich ist das man das begrenzen kann! :( ich blicke da nicht durch!
Title: Re: [Mod] User upload limits
Post by: jotabonfim on July 07, 2008, 07:03:28 PM
Ich würde gerne wissen wie das nun möglich ist das man das begrenzen kann! :( ich blicke da nicht durch!


Sorry I do not speak German!
Title: Re: [Mod] User upload limits
Post by: Sunny C. on August 10, 2008, 12:03:36 AM
Gibt es denn nun eine Lösung dafür?
Ich weis absolut nicht wie man das begrenzen kann!?
Ich habe die Mod genutzt auch im phpmyadmin steht es auf 3 dennoch geht es nicht...
Title: Re: [Mod] User upload limits
Post by: jotabonfim on September 08, 2008, 06:59:49 PM
Hello boys!

This module already completed 5 years of life   and so far nobody has found a solution to the bug him.

Does anyone here has no Forum able to resolve this bug?

BUG: /member.php?action=uploadform

This module very interesting for me and I am willing to pay to have this correction on my website.

Who is interested?  :D

Thank you
Title: Re: [Mod] User upload limits
Post by: V@no on September 09, 2008, 01:42:50 AM
Does anyone here has no Forum able to resolve this bug?

BUG: /member.php?action=uploadform
I doubt anyone could possible solve this kind of bug and that's probably because of the bug description.

If you want someone help you, you must explain EXACTLY what doesn't work
Quote
BUG: /member.php?action=uploadform
That explanation creates only one sound and one thought: "HUH? it looks like the bug is between keyboard and chair" :P ;)

So, take 10 minutes of your time sit down and type EXACTLY what happens after you install this mod, what you see, what you should see but you don't. Even create a screenshot or post a link to the page if possible. All that could be very useful to squish the BUG.
Title: Re: [Mod] User upload limits
Post by: jotabonfim on September 09, 2008, 02:23:30 AM
OK I will explain better.
http://localhost/4images/member.php?action=uploadform  

You'll see that the module will not work properly leaving the user post as many photos as desired.

If you enter the following way:
http://localhost/4images/member.php?action=uploadform&cat_id=68  
the module vai work properly.

I confess that not experienced with php, most also have no problem in understanding what happens between the keyboard and chair!.

Thank you for help.
Title: Re: [Mod] User upload limits
Post by: V@no on September 09, 2008, 02:47:02 AM
sorry, localhost is your local computer's address, only you, can access it. Provide a screenshot.
Title: Master, V@no - Help!
Post by: Sunny C. on September 10, 2008, 12:06:41 AM
 :flag-de:
Hallo zusammen, ich versuche schon seit langen nun die Modifikation Upload-Limit zu nutzen. Obwohl alles in Phpmyadmin eingetragen ist können die User mehr Bilder hochladen als angegeben! Kann es sein das diese Modifikation oder generell es keine Upload Begrenzung für 1.7.6 gibt?

Ich wollte V@no mal fragen ob er nicht Zeit hat eine Modifikation zu bauen die es schafft eine Begrenzung einzubauen! Ich habe da auch zwei bis drei Ideen. Das man im Adminbereich die Begrenzung nach belieben einstellen kann. Und das man die begrenzung auch für einzelne Kategorien einstellen kann, direkt bei der Kategorie Erstellung!




:flag-en:
I already have a try since be enough the modification to use upload limit now hello together. Can the users upload more pictures than indicated although everything is listed in Phpmyadmin!
can be it this no-one this modification or generally it upload gives limitation for 1.7.6?

I wanted to ask V@no whether he does not have time to build a modification this one manages to install a limitation! I also have two to three ideas there. This can one the limitation adjust in the admin area after wish. One can adjust the limitation and this also for some categories directly at the category construction!
Title: Re: [Mod] User upload limits
Post by: jotabonfim on September 15, 2008, 08:18:05 PM
sorry, localhost is your local computer's address, only you, can access it. Provide a screenshot.

Hello Vano.

See the screen below!
I am with the module installed and it does not work properly in version 1.7.6.

This will only work if I choose a category prior to upload.
Title: Re: [Mod] User upload limits
Post by: bacterio on October 03, 2008, 10:09:57 AM
Hello.
In order to limit the number of photos to 100 by author and a daily photo can not create a new row in the table 4images_users  with an added value 100 "if column> 100 does not upload" and leave "User upload limits" set opara a photo a day ?
Greetings
Title: Re: [Mod] User upload limits
Post by: jotabonfim on October 08, 2008, 10:30:18 PM
do not get it could give an example of how to do this in the source code? :wink:
Title: Re: [Mod] User upload limits
Post by: bacterio on October 08, 2008, 10:48:01 PM
  Hello!

Well, as I have achieved ... I can already have limited the rise and rise daily total per user at a time.

I added these lines just below the MOD:

- In member.php search:

//-----------------------------------------------------
// --- Check User Limits ------------------------------
//-----------------------------------------------------

- Add before:


if ( $user_info['user_t_images'] > 100) {
    show_error_page($lang['max_images']);
    exit;
}


Add in yoour lang:


$lang['max_images'] = "<br><br><br><b>Superado el límite de 100 fotografias permitidas en tu galería</b> ";


My limitations prevent me from being able to control this information from the administration in different categories of users, for example:

Gold Username: 100
User Silver: 50
User Bronze: 25

Any help or suggestion?


[EDIT by V@no]
Please use [code][/code] or [php][/php] tags for the code.
Title: Re: [Mod] User upload limits
Post by: darkcurves on February 15, 2009, 01:45:09 PM
Can this mod have daily quota? For example, everyone can only upload max 5 images per day. The next day, they can upload another 5.  :)
Title: Re: [Mod] User upload limits
Post by: V@no on February 15, 2009, 08:16:46 PM
Yes it can.
Title: Re: [Mod] User upload limits
Post by: darkcurves on February 16, 2009, 04:47:36 AM
Thanks. I have a problem. When i tried running install_user_limits.php, i get this error below:

Quote
DB Error: Bad SQL Query: INSERT INTO 4images_settings () VALUES ('default_upload_limit', )
You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ')' at line 4

DB Error: Bad SQL Query: ALTER TABLE phpbb_users ADD user_limit SMALLINT(3) DEFAULT NOT NULL
You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'NOT NULL' at line 2

I have PHPBB2 Integration mod installed. Something to do with that? Thanks
Title: Re: [Mod] User upload limits
Post by: V@no on February 16, 2009, 05:26:55 AM
use the installer from the attached to the original post package.

P.S. its a good practice review the topic before start downloading and installing stuff ;)
to make it more visible, I've highlighted the note regarding the installer with red color in the original post.
Title: Re: [Mod] User upload limits
Post by: darkcurves on February 16, 2009, 07:56:26 AM
Ah, my mistake. Very sorry about that.

I think this mod is done for. I already set daily limit of 3 but i notice many can upload more than that. Weird, it stops me though. I can only upload max 3 files. Issue with the mod or problem on my side. I am using 1.7.4 version.
Title: Re: [Mod] User upload limits
Post by: darkcurves on February 17, 2009, 05:09:29 AM
How can i remove this MOD? I have backed up my files, so that should be easy. How can i delete the new additions to the database by this mod?
Title: Re: [Mod] User upload limits
Post by: V@no on February 17, 2009, 05:39:06 AM
run this MySQL query in phpmyadmin:
Code: (MySQL) [Select]
DELETE FROM 4images_settings WHERE 4images_settings.setting_name = 'default_upload_limit';
ALTER TABLE 4images_users DROP user_limit;
Title: Re: [Mod] User upload limits
Post by: darkcurves on February 19, 2009, 08:27:49 AM
Thanks.  :D
Title: Re: [Mod] User upload limits
Post by: mohsensemsarpour on March 13, 2009, 08:12:43 AM
I use this mod
all think is ok but when a user want to upload a pic this error is shown

Code: [Select]
erorr :
Fatal error: Cannot redeclare check_daily_picture_limit() (previously declared in /home/fanoosar/public_html/photo/member.php:716) in /home/fanoosar/public_html/photo/member.php on line 814
Title: Re: [Mod] User upload limits
Post by: mstgokcen on March 14, 2009, 01:52:28 PM
this mod is not working for unvalidated images.
User can upload many photos if there is a validation in that category. MOD only works for validated photos.

How can we also put a limit for uploading for both validated or unvalidated photos?
Title: Re: [Mod] User upload limits
Post by: darkcurves on March 17, 2009, 12:24:13 PM
Dont bother trying, this mod doesn't work.
Title: Re: [Mod] User upload limits
Post by: alekseyn1 on December 08, 2009, 08:57:13 PM
That's too bad...
I have not tried it though....

anyone got it to work with 1.7.7?
Title: Re: [Mod] User upload limits
Post by: alekseyn1 on December 22, 2009, 11:31:03 AM
Hello boys!

This module already completed 5 years of life   and so far nobody has found a solution to the bug him.

Does anyone here has no Forum able to resolve this bug?

BUG: /member.php?action=uploadform

This module very interesting for me and I am willing to pay to have this correction on my website.

Who is interested?  :D

Thank you


here is a quick fix... please post here if you find a problem with this solution...

instead of in member.php
Code: [Select]
if ($cat_id != 0 && (!isset($cat_cache[$cat_id]) || !check_daily_picture_limit($user_id))) {
use this line
Code: [Select]
if (!check_daily_picture_limit($user_id)) {
not sure why there was a check for category number....
Title: Re: [Mod] User upload limits
Post by: V@no on December 23, 2009, 01:53:19 AM
Thank you alekseyn1, I've attached to the original post package with fixed instructions.


this mod is not working for unvalidated images.
User can upload many photos if there is a validation in that category. MOD only works for validated photos.

How can we also put a limit for uploading for both validated or unvalidated photos?

Uncomment these lines in member.php (remove //)
  // $sql = "SELECT image_id FROM ".IMAGES_TEMP_TABLE." WHERE user_id=$user_id";
  // $result = $site_db->query($sql);
  // $tmp_images_per_user = $site_db->get_numrows($result);
  // $images_per_user = $tmp_images_per_user + $images_per_user;


Title: Re: [Mod] User upload limits
Post by: Loda on December 28, 2009, 05:42:33 PM
Quote
here is a quick fix... please post here if you find a problem with this solution...

instead of in member.php
Code: [Select]
if ($cat_id != 0 && (!isset($cat_cache[$cat_id]) || !check_daily_picture_limit($user_id))) {
use this line
Code: [Select]
if (!check_daily_picture_limit($user_id)) {
not sure why there was a check for category number....

Thank you very much, it works a few days, but when i got uploadlimit i see that no action with the member.php will run. you even see the limit text if you klick on e.g. other user profiles.
Title: Re: [Mod] User upload limits
Post by: MrAndrew on June 04, 2010, 11:56:21 PM
Hi

Why i have this error when change this part:

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;
  }

To:

Code: [Select]
//-----------------------------------------------------
// --- Check User Limits ------------------------------
//-----------------------------------------------------

$user_id = $user_info['user_id'];

$clickstream = "<span class=\"clickstream\"><a href=\"".$site_sess->url(ROOT_PATH."index.php")."\" class=\"clickstream\">".$lang['home']."</a>".$config['category_separator'];
if ($cat_id && isset($cat_cache[$cat_id])) {
  $clickstream .= get_category_path($cat_id, 1).$config['category_separator'];
}
$clickstream .= $lang['file_upload_error']."</span>";

$site_template->register_vars(array(
"clickstream" => $clickstream,
"lang_no_limits" => $lang['no_limits'],
"lang_no_limits_text" => $lang['no_limits_text'],
"lang_already_loaded" => $lang['already_loaded'],
"lang_show_my_images" => $lang['show_my_images'],
"url_show_user_images" => $site_sess->url(ROOT_PATH."search.php?search_user=".$user_info['user_name'])
));


function check_daily_picture_limit($user_id) {
global $site_db, $site_template;

  $sql = "SELECT user_limit FROM ".USERS_TABLE." WHERE user_id = $user_id";
  $row = $site_db->query_firstrow($sql);
  $upload_limit = ($row['user_limit']);
  $site_template->register_vars("upload_limit", $upload_limit);
 
  $limit_cutoff = time() - 60 * 60 * 24;
 
  $sql = "SELECT COUNT(image_id) AS num_rows_all
  FROM ".IMAGES_TABLE."
  WHERE image_active = 1 AND user_id=$user_id AND image_date > $limit_cutoff";
  $row = $site_db->query_firstrow($sql);
  $images_per_user = $row['num_rows_all'];
 
  $site_template->register_vars("images_per_user", $images_per_user);

  return ($images_per_user < $upload_limit)
}

function check_picture_limit($user_id) {
global $site_db, $site_template;

  $sql = "SELECT user_limit FROM ".USERS_TABLE." WHERE user_id = $user_id";
  $row = $site_db->query_firstrow($sql);
  $upload_limit = ($row['user_limit']);
 
  $site_template->register_vars("upload_limit", $upload_limit);
 
  $sql = "SELECT COUNT(image_id) as num FROM ".IMAGES_TABLE." WHERE user_id=$user_id";
  $result = $site_db->query_firstrow($sql);
  $images_per_user = (int)$result['num'];
/*
  $sql = "SELECT image_id FROM ".IMAGES_TEMP_TABLE." WHERE user_id=$user_id";
  $result = $site_db->query($sql);
  $tmp_images_per_user = $site_db->get_numrows($result);
  $images_per_user = $tmp_images_per_user + $images_per_user;
*/
  // Uncomment above four lines (remove /* and */) if you also want to check uploaded but not yet validated images against the user limit
 
  $site_template->register_vars("images_per_user", $images_per_user);
 
  return ($images_per_user < $upload_limit)
}

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;
 }

if (!check_picture_limit($user_id)) {
// if (!check_daily_picture_limit($user_id)) {

//
// Depending on your requirements, you can either check against global or daily limit. For global check leave it as it is now.
// For daily limit comment first line and uncomment second one.
//

  $site_template->print_template($site_template->parse_template("over_limit"));
  include(ROOT_PATH.'includes/page_footer.php');
  exit;
}

//-----------------------------------------------------

Error: Parse error: syntax error, unexpected '}' in /home/users2/d/........................  on line 1039

Thanks for any help!
Title: Re: [Mod] User upload limits
Post by: V@no on June 05, 2010, 03:02:54 AM
Why i have this error when change this part:
Most likely because you do it wrong...

If you would show your modified code, including 10 lines above and 10 lines below it, you might get a better answer ;)
Title: Re: [Mod] User upload limits
Post by: MrAndrew on June 05, 2010, 08:55:38 AM
OK, thanks :)

Code: [Select]
     $content .= "<table border=\"0\" align=\"center\">\n<tr>\n<td>\n<a href='".$uploaded_image_link."'>".$media."</a>\n</td>\n</tr>\n</table>\n";
      $content .= "<table border=\"0\" width=\"500px\" align=\"center\">\n<tr>\n<td>\n".$uploadinfo."\n</td>\n</tr>\n</table>\n";

//-----------------------------------------------------
//--- end of UploadInfo v1.0 --------------------------
//-----------------------------------------------------
    }
    else {
      $action = "uploadform";
      $sendprocess = 1;
    }
  }
  else {
    $action = "uploadform";
    $sendprocess = 1;
  }
}

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;
  }

  $txt_clickstream = "";
  if ($cat_id && isset($cat_cache[$cat_id])) {
    $txt_clickstream .= get_category_path($cat_id, 1).$config['category_separator'];
  }
  $txt_clickstream .= $lang['user_upload'];

  if (!$sendprocess) {
    $remote_media_file = "";
    $remote_thumb_file = "";
    $image_name = "";
    $image_description = "";
    $image_keywords = "";
    $image_download_url = "";
    $image_allow_comments = 1;
  }

This is oiginal file, which i updating
Title: Re: [Mod] User upload limits
Post by: V@no on June 05, 2010, 05:28:54 PM
I don't see any code from the mod...
You were supposed to replace the 5 lines you mentioned in your fist post with the new code.
Title: Re: [Mod] User upload limits
Post by: MrAndrew on June 05, 2010, 07:57:45 PM
Vano, this give me error:

Code: [Select]
//-----------------------------------------------------
//--- end of UploadInfo v1.0 --------------------------
//-----------------------------------------------------
    }
    else {
      $action = "uploadform";
      $sendprocess = 1;
    }
  }
  else {
    $action = "uploadform";
    $sendprocess = 1;
  }
}

//-----------------------------------------------------
// --- Check User Limits ------------------------------
//-----------------------------------------------------

$user_id = $user_info['user_id'];

$clickstream = "<span class=\"clickstream\"><a href=\"".$site_sess->url(ROOT_PATH."index.php")."\" class=\"clickstream\">".$lang['home']."</a>".$config['category_separator'];
if ($cat_id && isset($cat_cache[$cat_id])) {
  $clickstream .= get_category_path($cat_id, 1).$config['category_separator'];
}
$clickstream .= $lang['file_upload_error']."</span>";

$site_template->register_vars(array(
"clickstream" => $clickstream,
"lang_no_limits" => $lang['no_limits'],
"lang_no_limits_text" => $lang['no_limits_text'],
"lang_already_loaded" => $lang['already_loaded'],
"lang_show_my_images" => $lang['show_my_images'],
"url_show_user_images" => $site_sess->url(ROOT_PATH."search.php?search_user=".$user_info['user_name'])
));


function check_daily_picture_limit($user_id) {
global $site_db, $site_template;

  $sql = "SELECT user_limit FROM ".USERS_TABLE." WHERE user_id = $user_id";
  $row = $site_db->query_firstrow($sql);
  $upload_limit = ($row['user_limit']);
  $site_template->register_vars("upload_limit", $upload_limit);
  
  $limit_cutoff = time() - 60 * 60 * 24;
  
  $sql = "SELECT COUNT(image_id) AS num_rows_all
  FROM ".IMAGES_TABLE."
  WHERE image_active = 1 AND user_id=$user_id AND image_date > $limit_cutoff";
  $row = $site_db->query_firstrow($sql);
  $images_per_user = $row['num_rows_all'];
  
  $site_template->register_vars("images_per_user", $images_per_user);

  return ($images_per_user < $upload_limit)
}

function check_picture_limit($user_id) {
global $site_db, $site_template;

  $sql = "SELECT user_limit FROM ".USERS_TABLE." WHERE user_id = $user_id";
  $row = $site_db->query_firstrow($sql);
  $upload_limit = ($row['user_limit']);
  
  $site_template->register_vars("upload_limit", $upload_limit);
  
  $sql = "SELECT COUNT(image_id) as num FROM ".IMAGES_TABLE." WHERE user_id=$user_id";
  $result = $site_db->query_firstrow($sql);
  $images_per_user = (int)$result['num'];
/*
  $sql = "SELECT image_id FROM ".IMAGES_TEMP_TABLE." WHERE user_id=$user_id";
  $result = $site_db->query($sql);
  $tmp_images_per_user = $site_db->get_numrows($result);
  $images_per_user = $tmp_images_per_user + $images_per_user;
*/
  // Uncomment above four lines (remove /* and */) if you also want to check uploaded but not yet validated images against the user limit
  
  $site_template->register_vars("images_per_user", $images_per_user);
  
  return ($images_per_user < $upload_limit)
}

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;
 }

if (!check_picture_limit($user_id)) {
// if (!check_daily_picture_limit($user_id)) {

//
// Depending on your requirements, you can either check against global or daily limit. For global check leave it as it is now.
// For daily limit comment first line and uncomment second one.
//

  $site_template->print_template($site_template->parse_template("over_limit"));
  include(ROOT_PATH.'includes/page_footer.php');
  exit;
}

//-----------------------------------------------------

  $txt_clickstream = "";
  if ($cat_id && isset($cat_cache[$cat_id])) {
    $txt_clickstream .= get_category_path($cat_id, 1).$config['category_separator'];
  }
  $txt_clickstream .= $lang['user_upload'];

  if (!$sendprocess) {

This code with about 10 lines above and below...
Title: Re: [Mod] User upload limits
Post by: nameless on August 06, 2010, 01:33:25 AM
I have this error
i'm using v1.77

Parse error: syntax error, unexpected '}' in /home/???????/member.php on line 739

and this is the code

Code: [Select]
function check_daily_picture_limit($user_id) {
global $site_db, $site_template;

  $sql = "SELECT user_limit FROM ".USERS_TABLE." WHERE user_id = $user_id";
  $row = $site_db->query_firstrow($sql);
  $upload_limit = ($row['user_limit']);
  $site_template->register_vars("upload_limit", $upload_limit);
  
  $limit_cutoff = time() - 60 * 60 * 24;
  
  $sql = "SELECT COUNT(image_id) AS num_rows_all
  FROM ".IMAGES_TABLE."
  WHERE image_active = 1 AND user_id=$user_id AND image_date > $limit_cutoff";
  $row = $site_db->query_firstrow($sql);
  $images_per_user = $row['num_rows_all'];
  
  $site_template->register_vars("images_per_user", $images_per_user);

  return ($images_per_user < $upload_limit)
} >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>this is the line

function check_picture_limit($user_id) {
global $site_db, $site_template;

  $sql = "SELECT user_limit FROM ".USERS_TABLE." WHERE user_id = $user_id";
  $row = $site_db->query_firstrow($sql);
  $upload_limit = ($row['user_limit']);
  
  $site_template->register_vars("upload_limit", $upload_limit);
  
  $sql = "SELECT COUNT(image_id) as num FROM ".IMAGES_TABLE." WHERE user_id=$user_id";
  $result = $site_db->query_firstrow($sql);
  $images_per_user = (int)$result['num'];
/*
  $sql = "SELECT image_id FROM ".IMAGES_TEMP_TABLE." WHERE user_id=$user_id";
  $result = $site_db->query($sql);
  $tmp_images_per_user = $site_db->get_numrows($result);
  $images_per_user = $tmp_images_per_user + $images_per_user;
*/
  // Uncomment above four lines (remove /* and */) if you also want to check uploaded but not yet validated images against the user limit
  
  $site_template->register_vars("images_per_user", $images_per_user);
  
  return ($images_per_user < $upload_limit)
}
Title: Re: [Mod] User upload limits
Post by: V@no on August 06, 2010, 04:44:18 AM
missing ; at the end of
  return ($images_per_user < $upload_limit)


I've fixed the attachment.
Title: Re: [Mod] User upload limits
Post by: nameless on August 06, 2010, 01:50:33 PM
Thanks V@no

but there is something

  return ($images_per_user < $upload_limit)

there is 2 line and u fix one of them and it still error so i but ; at the end of the scoend line and it work

please fix it the attachment

Now let me tell u all i have found
i make the defoult limit upload is 10 image

1- when i add a new user from the admincp there is a new field called Maximum number of images to upload i put 5 in this field for this user

Now i go try to upload an image but it do't work it gave me over_limit.html i make another use and gave me the same i go to the admin cp try to edit Maximum number of images to upload for the user and i did't found this field it just Appears when you make a new user only but if u want to eidt the use it does't Appears

2- i go to the admincp to change in the seitting to change Maximum number of images to upload from 10 to 20 and i try to upload images to a user that reached this limit (10 image) and it does't work

3- i make this http://www.4homepages.de/forum/index.php?topic=3607.msg22301#msg22301
reset_limits.php and when i try it it gave me this erorr
Parse error: syntax error, unexpected '&', expecting T_PAAMAYIM_NEKUDOTAYIM in /home/??????/admin/plugins/reset_limits.php on line 5

will sorry to bother you

but i think this a great mod and i hope it work
Title: Re: [Mod] User upload limits
Post by: maranus on November 21, 2011, 02:14:03 PM
i konw this is old, but i'm having a problem, after i install this MOD login and logout returned blank pages ....

any ideia why ?

thanks
Title: Re: [Mod] User upload limits
Post by: V@no on November 21, 2011, 02:29:42 PM
Welcome to 4images forum.

I'd suspect when you edited .php files you added an extra space or new line after ?> or before <?php
Check lang/<your language>/main.php (and all others)
Title: Re: [Mod] User upload limits
Post by: maranus on November 21, 2011, 02:56:37 PM
shame on me,  :oops:

i'm a PHP newbieeee sorry !!! thanks you re right !!!!  :P

sorry to bother again

DB Error: Bad SQL Query: UPDATE 4images_users SET user_level = 9, user_name = 'BMMaia', user_email = 'bmtcmaia@gmail.con', user_showemail = 0, user_allowemails = 1, user_invisible = 0, user_joindate = UNIX_TIMESTAMP('2011-11-21 15:25'), user_lastaction = UNIX_TIMESTAMP('2011-11-21 15:25'), user_homepage = '', user_icq = '', = '5', WHERE user_id = 4
You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '= '5', WHERE user_id = 4' at line 2
Error editando usuario

i'm having this error when editing a user, any solucion ? what could be wrong? i'm guessing something to do with declaring "user_limit" variable ....

thanks again
Title: Re: [Mod] User upload limits
Post by: V@no on November 21, 2011, 08:00:06 PM
I assume you did the posted fix at first post, then the problem in that line, you missed some part of it.
Title: Re: [Mod] User upload limits
Post by: pwa on November 23, 2011, 01:08:25 PM
Hi,
Very nice mod. i used it on version 1.7.10 with daily limit option.
I corrected this bug:

Quote
this mod is not working for unvalidated images.
User can upload many photos if there is a validation in that category. MOD only works for validated photos.
new version of check_daily_picture_limit function (file member.php):

function check_daily_picture_limit($user_id) {
global $site_db, $site_template;
  $sql = "SELECT user_limit FROM ".USERS_TABLE." WHERE user_id = $user_id";
  $row = $site_db->query_firstrow($sql);
  $upload_limit = ($row['user_limit']);
  $site_template->register_vars("upload_limit", $upload_limit);
 
  $limit_cutoff = time() - 60 * 60 * 24;
 
  $sql = "SELECT COUNT(image_id) AS num_rows_all
  FROM ".IMAGES_TABLE."
  WHERE user_id=$user_id AND image_date > $limit_cutoff";
  //WHERE image_active = 1 AND user_id=$user_id AND image_date > $limit_cutoff";
  $row = $site_db->query_firstrow($sql);
  $images_per_user = $row['num_rows_all'];
 
  //look for unvalidated images too
  $sql = "SELECT COUNT(image_id) AS num_rows_all
  FROM ".IMAGES_TEMP_TABLE."
  WHERE user_id=$user_id  AND image_date > $limit_cutoff";
  $row = $site_db->query_firstrow($sql);
  $images_per_user = $images_per_user + $row['num_rows_all']; 
 
  $site_template->register_vars("images_per_user", $images_per_user);

  return ($images_per_user <= $upload_limit);
}



On error page number of already uploaded images is not displayed - I corrected this too:
in lang file main.php:
$lang['show_my_images'] = "Number of submited images (accepted and awaiting for validation): ";

and in over_limit.html:
Code: [Select]
                 
<p>{lang_no_limits_text}</p>
{lang_show_my_images}{images_per_user}
look it is no way to show via search screen unvalidated images (I removed this link)


I used code from first post as base.



Title: Re: [Mod] User upload limits
Post by: Loda on January 09, 2012, 10:05:05 AM
another question:
i want to see the "time_to_go" tag in my profile or in userbox. any help for me?