4images Forum & Community
4images Modifications / Modifikationen => Mods & Plugins (Releases & Support) => Topic started by: SLL on January 15, 2003, 01:46:11 PM
-
################################################################################################
## 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:
($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:
($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.")";
-
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
-
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..."
-
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
-
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..
-
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
-
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...
-
If anyone could do this please do I will be extremely greatful.
Steve
-
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
-
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...
-
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
-
but did u do all changes discribed in the instructions?
-
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 # 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
-
well, u missunderstud. its only about setting up database. the rest u'll need do manualy.
-
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
# 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
-
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:
-
Some DNS problems at my host :twisted:
Just added alternative d/l link in the first message.
-
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
-
files are the same, if no other mod's used, but this wount help you much, since you have to modify your database also
-
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
-
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
-
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
-
is it possible to make the upload limit by time?
in a way that users can only upload a pic per day
-
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: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;
}
}
-
Is this change for a photo in 24 hours or per day (to 24 o'clock) The latter would be better.
CU Ingo.
-
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.
-
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
-
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.
-
so i put this code:
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?
-
yes, you can do this. just replace the original mod function to this one: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:
-
well i put that code after
<?php
in the install_user_limits, is that correct?
-
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.
-
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
));
$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'];
-
this part seems to be ok. check if all other mod steps has been done right way.
-
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:
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: $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:
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:
show_setting_row("max_media_size");
show_setting_row("default_upload_limit");
and the rest were the lang files.
thanks
-
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.
-
:( 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
-
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:
-
did it actualy worked before "time limit" changes?
-
yes, before this i and the other members were able to upload the pics.
when will it be out the fresh 4images?
-
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 :)
-
Ich bekomme schon beim ausführen der "install_user_limits.php" folgende Fehlermeldung:
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.
-
just ignore this error message, it won't influence anything
-
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
-
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
-
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.
-
well, well, if you're such in trouble :wink: ...
then do the following:
in member.php find code:$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:$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
-
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!
-
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
-
Sorry, misread the post, I've removed my post as it didnt answer the question properly.
-
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.
-
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
<?php // PLUGIN_TITLE: Reset User Limits
define('IN_CP', 1);
$root_path = (eregi("\/plugins\/", $PHP_SELF)) ? "./../../" : "./../";
define('ROOT_PATH', $root_path);
require(ROOT_PATH.'admin/admin_global.php');
if ( $action == "") {
$action = "modifysettings";
}
show_admin_header();
if ($action == "showsettings") {
$fldname = "user_limit";
$default_limit = $config['default_upload_limit'];
$sql = "UPDATE ".USERS_TABLE."
SET $fldname = $default_limit";
$site_db->query($sql);
if ($HTTP_POST_VARS['setting_item']['language_dir'] != $config['language_dir']) {
printf("<b>%s</b><p>", $lang['save_settings_success']);
show_admin_footer();
}
else {
$msg = sprintf("<b>%s</b><p>", $lang['save_settings_success']);
$action = "modifysettings";
}
}
if ($action == "modifysettings") {
if (isset($HTTP_GET_VARS['settings_msg'])) {
printf("<b>%s</b><p>", urldecode($HTTP_GET_VARS['settings_msg']));
}
elseif (!empty($msg)) {
echo $msg;
}
$sql = "SELECT setting_name, setting_value
FROM ".SETTINGS_TABLE;
$result = $site_db->query($sql);
$config = array();
while ($row = $site_db->fetch_array($result)) {
$config[$row['setting_name']] = $row['setting_value'];
}
show_form_header("$PHP_SELF", "showsettings");
show_table_header("Reset all users upload limit to the default value");
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()."\">\n<td valign=\"top\"><p class=\"rowtitle\">Default upload limit from Gallery config</p></td>\n";
echo "<td>".$config['default_upload_limit']."<p>";
echo "</p></td>\n</tr>\n";
show_form_footer($lang['save_changes'], "", 2);
}
show_admin_footer();
?>
-
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:
-
So, 25 upload images, and unlimited url images. Do you think this would be possible somehow?
Replace this query: $sql = "SELECT image_id FROM ".IMAGES_TABLE." WHERE user_id=$user_id";
With this one: $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.
-
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.
-
hmm.... sorry, no way for the moment. just edit $lang['no_limits_text'] and write there "... within next 24 hours" :wink:
-
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
-
bomba, you're asking exactly the same question as batz one message above :roll:
-
oops... you're right... i guess i jumped that last message... sorry.
-
Thanks anyway SLL. :)
Bomba: I came first :P
-
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: 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
-
What can i say... man, you are the man :D This MOD, for me, now is completed. Absolutely great.
Many thanks
-
GREAT!
just one little thing
i don't have
function check_daily_picture_limit($user_id) {
what i have is
function check_picture_limit($user_id) {
should i copy this new code exactly like u told or should i change it to function check_picture_limit($user_id) {
?
thanks
-
This is strange, but SLL could tell you better :wink:
The question is: If you don't have the function check_daily_picture_limit($user_id) {
how are you using the User limits MOD?
Search that function above the function check_picture_limit($user_id) {
-
just one little thing
i don't have
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.
-
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?
-
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.
-
do u think that is there any problem if i change my code:
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
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?
-
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:
-
cause im affraid of making some "fatal error" and then i can't solv it :roll:
:wink:
-
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:
-
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
-
seems you didn't run the installer, so the neccessary fields were not added to your db
-
i run the install file....
whcih will add.....a limit field into users table right??
i checked~
or should i run it again~?
-
Problem found!
change
$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:
$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
-
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
-
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.
-
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
-
Please explain.
-
I would like to indicate the limit in the Memberprofil the user. What
there do I have to make?
-
you can see in lang\main.php >
$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
-
sorry, does not function. it is indicated nothing!
-
:? this vars registred with over_limits.html template only... sorry, i can't tell you for the moment how to use it in profile
-
hallo
was soll ich machen damit es auch mit phpBB funktioniert?
danke im Vorraus
-
kann mir Jemand helfen?
ein kleiner Tip were genügend ;)
danke
-
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
-
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 ;)
-
try to insert below:
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: 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
-
Actualy I get this msg:
Parse error: parse error, unexpected ')' in /home/.../member.php on line 504
Line 504:
if (!check_daily_picture_limit($user_info['user_id']))) {
-
sorry, remove one ")" from that line. (I've updated my post)
-
I have installed daily limit, but after few months I'm getting this error:
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
-
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..
-
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)
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)
-
hat niemand eine idee?
habe die anleitung nochmal durchgelesen, sehe allerdings keinen fehler 8O
any ideas?
i read the manual again, but don't see any errors.
-
is there still any support for this mod ?
-
is there still any support for this mod ?
perhaps you didnt know that the author of this mod does not speak deutsch...
-
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. :(
-
hmm, thanks anyway
-
i found here (http://faces.dalnet.ru/files.php?l=english) only the version 1.1 - where can i found the version 1.2?
-
ok, hat irgendjemand noch die zip datei und kann sie mir schicken? dosensteck@chello.at
wäre wirklich super :)
-
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
-
Hi!
My problem : I installed tihs mod.
The users, when registred after the mod install, the mod doesen't work, olny the old users.
-
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.
-
: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?
-
I think its a bug...
Remove all changes from register.php (ok, it will work even if you leave them ;))
Then find: $additional_value_sql = "";
Insert below:
$HTTP_POST_VARS['user_limit'] = $config['default_upload_limit'];
-
Re
I insert the code,the register.php but don't happend enything.
-
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.
-
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?
-
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'
-
I still dont understand what EXACTLY doesnt 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'
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?
-
I still dont understand what EXACTLY doesnt work?
The upload limit the new users.
-
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.
-
- 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!
-
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!
-
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.
-
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)
-
:)
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.
-
Who can help me solve that problem?
In my gallery when you upload photo you'll get these errors:
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:
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
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!
-
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
-
Run the installer again. Also, would not hurt open the instructions again, its all there ;)
INSERT INTO `4images_settings` (`setting_name`, `setting_value`) VALUES ('default_upload_limit', '5');
-
Hello and thanks V@no
allready is running :mrgreen:
Greez Darkness
-
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???
-
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
-
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?
-
Frage
Kriegt man den User upload limits auch in deutsch? Bin der englischen Sprache nicht so mächtig
Danke
-
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?
-
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
-
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)
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)
-
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
-
I've attached a fixed version of the installer in the original topic, please use that one.
-
it's working .. thank you
-
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. :(
-
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.
-
I cant suggest the mod, because no one can help us and i dont know why, the mod dont work...
Whatever...
-
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
-
Restore admin/users.php from backups and try again, you made a misstake somewhere in the code.
-
in the 23th post you say use this code for 24hours limit...
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
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
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 ?
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;
}
-
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
-
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
-
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
-
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 ??
-
HI knows the reply for this question?
http://www.4homepages.de/forum/index.php?topic=3607.msg57337#msg57337
-
Hi, does anyone have this mod in full working? If yes could you send me a pm where to download it?
-
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
-
Hello, i have n00b question.
Where is instruction for install this mod?
In install pack are not exist.
Please help me, Ferus
-
:)
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
-
:)
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!
-
I discovered plus one bug in this module, it I am incompatible with version 1.7.4 !
-
Hi all has some reply for this!
I am made use to pay to have this module functioning correctly. :oops:
-
help!!!!! :cry: :cry: :cry:
-
help!!!!! :cry: :cry: :cry:
????
-
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.
-
Hi anybody,
Does this mod work fine in v1.74 ?
-
Good day!
How to make the general limit to the user accaunt in Mb? For example 20 or 30Mb ..... or other?
-
I get this DB error. Is it compatible with 1.7.4? Are there any other alternative upload limit script?
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
-
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:
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
-
It does not works with 1.7.6 version.... :(
-
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!
-
Diesen Mod verstehe ich nicht, warum begrenzt jemand das hochladen :?:
Seit ihr nicht froh, wenn sich eure Galerie füllt :wink:
-
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!
-
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.
-
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
-
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
-
Ich würde gerne wissen wie das nun möglich ist das man das begrenzen kann! :( ich blicke da nicht durch!
-
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!
-
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...
-
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
-
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
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.
-
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.
-
sorry, localhost is your local computer's address, only you, can access it. Provide a screenshot.
-
: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!
-
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.
-
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
-
do not get it could give an example of how to do this in the source code? :wink:
-
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.
-
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. :)
-
Yes it can.
-
Thanks. I have a problem. When i tried running install_user_limits.php, i get this error below:
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
-
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.
-
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.
-
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?
-
run this MySQL query in phpmyadmin:
DELETE FROM 4images_settings WHERE 4images_settings.setting_name = 'default_upload_limit';
ALTER TABLE 4images_users DROP user_limit;
-
Thanks. :D
-
I use this mod
all think is ok but when a user want to upload a pic this error is shown
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
-
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?
-
Dont bother trying, this mod doesn't work.
-
That's too bad...
I have not tried it though....
anyone got it to work with 1.7.7?
-
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
if ($cat_id != 0 && (!isset($cat_cache[$cat_id]) || !check_daily_picture_limit($user_id))) {
use this line
if (!check_daily_picture_limit($user_id)) {
not sure why there was a check for category number....
-
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;
-
here is a quick fix... please post here if you find a problem with this solution...
instead of in member.php
if ($cat_id != 0 && (!isset($cat_cache[$cat_id]) || !check_daily_picture_limit($user_id))) {
use this line
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.
-
Hi
Why i have this error when change this part:
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:
//-----------------------------------------------------
// --- 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!
-
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 ;)
-
OK, thanks :)
$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
-
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.
-
Vano, this give me error:
//-----------------------------------------------------
//--- 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...
-
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
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)
}
-
missing ; at the end of
return ($images_per_user < $upload_limit)
I've fixed the attachment.
-
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
-
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
-
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)
-
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
-
I assume you did the posted fix at first post, then the problem in that line, you missed some part of it.
-
Hi,
Very nice mod. i used it on version 1.7.10 with daily limit option.
I corrected this bug:
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:
<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.
-
another question:
i want to see the "time_to_go" tag in my profile or in userbox. any help for me?