View Full Version : Limit Attachments Per Time
Admin
03-11-2002, 10:00 PM
Allows you to limit the number of attachments one can post in X (defined) hours.
There is also an option to exclude mods and admins from this limit.
To install this hack download the attached file (lapt.hack.php), upload to your /admin folder and use vbHacker (https://vborg.vbsupport.ru/showthread.php?s=&threadid=36378).
A demo (screen shot of the new settings in the Admin CP) can be found here:
https://vborg.vbsupport.ru/attachment.php?s=&postid=232927
ExcErr
03-12-2002, 01:05 PM
lapt_queries.php doesn't work!
Not working for me niether.
Admin
03-12-2002, 01:21 PM
Try again...
ExcErr
03-12-2002, 01:26 PM
can you give this queries, i can run it in phpmyadmin manually!
Admin
03-12-2002, 01:29 PM
DOES work!!!
And no, I won't give you the queries. Since you have so much time to spend to yell at me, I'm sure you can find them yourself.
Seems to be working now, thanks.
ExcErr
03-12-2002, 02:09 PM
Originally posted by FireFly
DOES work!!!
And no, I won't give you the queries. Since you have so much time to spend to yell at me, I'm sure you can find them yourself.
sorry, firefly!
MrLister
03-12-2002, 02:36 PM
Originally posted by ExcErr
can you give this queries, i can run it in phpmyadmin manually!
you could just put all your posts into one rather then having 3 in less thn 1 minute!!
Great hack Chen, thanks :D
Is there a way to use the same thing to limt the the number of the posts & threads a moderator can edit or delete per day!
I am very concern someone might get one of my moderators Password and delete the hall forum!
If that hapend, I will be :angry: :hurt: :surprised: :cry: :knockedout: and :dead:
ExcErr
03-13-2002, 01:56 PM
great hack firefly! my friend run it on his board....works great!
but i can't run it on my ftp, don't know why! can't run queries in phpmyadmin, because it gives me error!
can you give(SORRY AGAIN) queries for manual installation??
thx in advance
Admin
03-13-2002, 02:05 PM
Just look at the lapt_queries.php file, there are 3 quereis you need to run (all start with "INERT INTO setting").
ExcErr
03-13-2002, 02:17 PM
SQL-query:
$DB_site->query("INSERT INTO setting (settingid,settinggroupid,title,varname,value,desc ription,optioncode,displayorde r) VALUES (NULL,27,'Maximum Attachments','limitattachnum','0','Set this to the number of attachments one can post in a given time range (which is set in the setting below). Set this to 0 to disable this feature.','','7')")
Answer MySQL:
You have an error in your SQL syntax near '$DB_site->query("INSERT INTO setting (settingid,settinggroupid,title,varname,val' at line 1
back
Admin
03-13-2002, 02:24 PM
INSERT INTO setting (settingid,settinggroupid,title,varname,value,desc ription,optioncode,displayorder) VALUES (NULL,27,'Maximum Attachments','limitattachnum','0','Set this to the number of attachments one can post in a given time range (which is set in the setting below). Set this to 0 to disable this feature.','','7')
is the query. The $DB_site->query(" and ") in that line are PHP bits.
ExcErr
03-13-2002, 02:43 PM
works perfectly! thx!
Admin
03-26-2002, 07:04 AM
Demo...
Thomas P
05-10-2002, 05:34 PM
Hi Chen,
thanks for that wonderful, mega-extreme cool hack.
It works perfectly on 2.2.5 and is very handy on my board.
I added my Board Staff member group to the excluded people (array(5,6,7,8)) and allow 2 attachments every 8 hours, size = 2Megs.
Thanks,
-Tom
Boofo
06-09-2002, 07:25 AM
I couldn't find the code for either file in the files themselves. The queries ran just fine but I can't finish the hack until I can find the code to replace. :) Anyone have any ideas on this, please? :)
Admin
06-09-2002, 07:26 AM
What version are you running?
Boofo
06-09-2002, 07:31 AM
I'm running version 2.2.5 :)
Originally posted by FireFly
What version are you running?
Admin
06-09-2002, 07:34 AM
Ok, it tells you to find this, right?
// sort attachement
if ($permissions[canpostattachment] and trim($attachment)!="none" and trim($attachment)!="" and trim($attachment_name)!="") {
Disregard the first line (the // comment), and just look for the second line.
Boofo
06-09-2002, 07:42 AM
This is why I couldn't find it. I had to narrow the search down to just canpostattachment. :) Usually any code you say to look for is right on target for me. I must have installed some hack somewhere that changed something. :)
Sorry I bothered you with it. I feel kindof stupid now. :)
if ($permissions['canpostattachment'] and trim($attachment) != 'none' and trim($attachment) != '' and trim($attachment_name) != '') {
Originally posted by FireFly
Ok, it tells you to find this, right?
// sort attachement
if ($permissions[canpostattachment] and trim($attachment)!="none" and trim($attachment)!="" and trim($attachment_name)!="") {
Disregard the first line (the // comment), and just look for the second line.
Boofo
06-09-2002, 07:52 AM
Here's the code I found it in in newreply. There are actually 2 places here that have that code. I should replace the first one?
case 'new':
if ($permissions['canpostattachment'] and trim($attachment) != 'none' and trim($attachment) != '' and trim($attachment_name) != '') {
$attachmentid = acceptupload(1);
$DB_site->query("
DELETE FROM attachment
WHERE attachmentid = $oldattachid
");
$postinfo = $DB_site->query_first("
SELECT attachmentid, filename FROM attachment
WHERE attachmentid = $attachmentid
");
}
break;
default:
$attachmentid = $oldattachid;
}
} elseif ($permissions['canpostattachment'] and trim($attachment) != 'none' and trim($attachment) != '' and trim($attachment_name) != '') {
$attachmentid = acceptupload(1);
$oldattachid = true;
$postinfo = $DB_site->query_first('
SELECT attachmentid, filename FROM attachment
WHERE attachmentid = '.intval($attachmentid).' AND visible = 0
');
Admin
06-09-2002, 07:53 AM
Ahh, you installed another hack that changes that part (my Save Attachments on Preview). Sorry.
Boofo
06-09-2002, 07:57 AM
Guess I should have installed this one first huh? :) Was I right, only the first part under case new gets changed? Thanks for helping me figure it out though. I was starting to think I was losing the ability to install hacks. :)
Originally posted by FireFly
Ahh, you installed another hack that changes that part (my Save Attachments on Preview). Sorry.
Admin
06-09-2002, 08:02 AM
I think you only need to update the 'new' case, but I'm not sure.
Boofo
06-09-2002, 08:13 AM
Well, the board didn't blow up or lock me out, so I think we did it. :) The options are there in the Admin settings so I guess that means it is working? Thanks, Chen, for all of your help on this one. :)
BTW: PM on the way.
Originally posted by FireFly
I think you only need to update the 'new' case, but I'm not sure.
blazin
12-22-2003, 02:08 AM
i have had this hack installed for quite some time, but ecently it has taken the forum very long to post a new thread or submit a reply.
I found out the slowness was due to this hack, particulary this line of code:
$attachcount = $DB_site->query_first('SELECT COUNT(*) AS total FROM attachment WHERE userid='.$bbuserinfo['userid'].' AND dateline>('.time().'-3600*'.$limitattachtime.')');
My attachment table is about 370MB with 7,700 records. When I make a simple query to this table in phpmyadmin, its very slow to respond also.
The rest of the site is extremely fast, any suggestions?
blazin
04-10-2004, 04:06 AM
any ideas on the above? anyone?
pimpfelix
02-08-2007, 03:00 PM
Is this hack available for 3.6?
blazin
04-15-2007, 07:58 AM
Is this hack available for 3.6?
yes, i am looking for something like this too.
vBulletin® v3.8.12 by vBS, Copyright ©2000-2025, vBulletin Solutions Inc.