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

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

0 Members and 1 Guest are viewing this topic.

Offline amber438

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

Offline SLL

  • Hero Member
  • *****
  • Posts: 585
    • View Profile
[Mod] User upload limits
« Reply #16 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.

Offline x_789

  • Newbie
  • *
  • Posts: 15
    • View Profile
    • http://www.dirtyrc.com
[Mod] User upload limits
« Reply #17 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

Offline SLL

  • Hero Member
  • *****
  • Posts: 585
    • View Profile
[Mod] User upload limits
« Reply #18 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

Offline x_789

  • Newbie
  • *
  • Posts: 15
    • View Profile
    • http://www.dirtyrc.com
[Mod] User upload limits
« Reply #19 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

Offline x_789

  • Newbie
  • *
  • Posts: 15
    • View Profile
    • http://www.dirtyrc.com
[Mod] User upload limits
« Reply #20 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

Offline SLL

  • Hero Member
  • *****
  • Posts: 585
    • View Profile
[Mod] User upload limits
« Reply #21 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

Offline Bomba

  • Full Member
  • ***
  • Posts: 202
    • View Profile
[Mod] User upload limits
« Reply #22 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

Offline SLL

  • Hero Member
  • *****
  • Posts: 585
    • View Profile
[Mod] User upload limits
« Reply #23 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;
}
}

Offline IngoT

  • Newbie
  • *
  • Posts: 49
    • View Profile
[Mod] User upload limits
« Reply #24 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.

Offline SLL

  • Hero Member
  • *****
  • Posts: 585
    • View Profile
[Mod] User upload limits
« Reply #25 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.

Offline Bomba

  • Full Member
  • ***
  • Posts: 202
    • View Profile
[Mod] User upload limits
« Reply #26 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

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
[Mod] User upload limits
« Reply #27 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.
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 Bomba

  • Full Member
  • ***
  • Posts: 202
    • View Profile
[Mod] User upload limits
« Reply #28 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?

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
[Mod] User upload limits
« Reply #29 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:
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)