• [Mod] User upload limits 5 0 5 1
Currently:  

Author Topic: [Mod] User upload limits  (Read 240098 times)

0 Members and 1 Guest are viewing this topic.

Offline darkcurves

  • Full Member
  • ***
  • Posts: 114
    • View Profile
    • KTM Railway Fan Club - Gallery
Re: [Mod] User upload limits
« Reply #180 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.

Offline darkcurves

  • Full Member
  • ***
  • Posts: 114
    • View Profile
    • KTM Railway Fan Club - Gallery
Re: [Mod] User upload limits
« Reply #181 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?

Offline V@no

  • If you don't tell me what to do, I won't tell you where you should go :)
  • Global Moderator
  • 4images Guru
  • *****
  • Posts: 17.849
  • mmm PHP...
    • View Profile
    • 4images MODs Demo
Re: [Mod] User upload limits
« Reply #182 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;
Your first three "must do" before you ask a question:
Please do not PM me asking for help unless you've been specifically asked to do so. Such PMs will be deleted without answer. (forum rule #6)
Extension for Firefox/Thunderbird: Master Password+    Back/Forward History Tweaks (restartless)    Cookies Manager+    Fit Images (restartless for Thunderbird)

Offline darkcurves

  • Full Member
  • ***
  • Posts: 114
    • View Profile
    • KTM Railway Fan Club - Gallery
Re: [Mod] User upload limits
« Reply #183 on: February 19, 2009, 08:27:49 AM »
Thanks.  :D

Offline mohsensemsarpour

  • Pre-Newbie
  • Posts: 2
    • View Profile
Re: [Mod] User upload limits
« Reply #184 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

Offline mstgokcen

  • Newbie
  • *
  • Posts: 44
    • View Profile
Re: [Mod] User upload limits
« Reply #185 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?

Offline darkcurves

  • Full Member
  • ***
  • Posts: 114
    • View Profile
    • KTM Railway Fan Club - Gallery
Re: [Mod] User upload limits
« Reply #186 on: March 17, 2009, 12:24:13 PM »
Dont bother trying, this mod doesn't work.

Offline alekseyn1

  • Full Member
  • ***
  • Posts: 102
    • View Profile
    • My Project
Re: [Mod] User upload limits
« Reply #187 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?

Offline alekseyn1

  • Full Member
  • ***
  • Posts: 102
    • View Profile
    • My Project
Re: [Mod] User upload limits
« Reply #188 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....

Offline V@no

  • If you don't tell me what to do, I won't tell you where you should go :)
  • Global Moderator
  • 4images Guru
  • *****
  • Posts: 17.849
  • mmm PHP...
    • View Profile
    • 4images MODs Demo
Re: [Mod] User upload limits
« Reply #189 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;


Your first three "must do" before you ask a question:
Please do not PM me asking for help unless you've been specifically asked to do so. Such PMs will be deleted without answer. (forum rule #6)
Extension for Firefox/Thunderbird: Master Password+    Back/Forward History Tweaks (restartless)    Cookies Manager+    Fit Images (restartless for Thunderbird)

Offline Loda

  • Sr. Member
  • ****
  • Posts: 353
    • View Profile
    • Fotosucht Schweiz
Re: [Mod] User upload limits
« Reply #190 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.

Offline MrAndrew

  • Sr. Member
  • ****
  • Posts: 302
    • View Profile
    • Aviation PhotoBase
Re: [Mod] User upload limits
« Reply #191 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!

Offline V@no

  • If you don't tell me what to do, I won't tell you where you should go :)
  • Global Moderator
  • 4images Guru
  • *****
  • Posts: 17.849
  • mmm PHP...
    • View Profile
    • 4images MODs Demo
Re: [Mod] User upload limits
« Reply #192 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 ;)
Your first three "must do" before you ask a question:
Please do not PM me asking for help unless you've been specifically asked to do so. Such PMs will be deleted without answer. (forum rule #6)
Extension for Firefox/Thunderbird: Master Password+    Back/Forward History Tweaks (restartless)    Cookies Manager+    Fit Images (restartless for Thunderbird)

Offline MrAndrew

  • Sr. Member
  • ****
  • Posts: 302
    • View Profile
    • Aviation PhotoBase
Re: [Mod] User upload limits
« Reply #193 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

Offline V@no

  • If you don't tell me what to do, I won't tell you where you should go :)
  • Global Moderator
  • 4images Guru
  • *****
  • Posts: 17.849
  • mmm PHP...
    • View Profile
    • 4images MODs Demo
Re: [Mod] User upload limits
« Reply #194 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.
Your first three "must do" before you ask a question:
Please do not PM me asking for help unless you've been specifically asked to do so. Such PMs will be deleted without answer. (forum rule #6)
Extension for Firefox/Thunderbird: Master Password+    Back/Forward History Tweaks (restartless)    Cookies Manager+    Fit Images (restartless for Thunderbird)