Go Back   vb.org Archive > vBulletin 3 Discussion > vB3 General Discussions
FAQ Community Calendar Today's Posts Search

Reply
 
Thread Tools Display Modes
  #11  
Old 07-25-2002, 10:15 AM
Xenon's Avatar
Xenon Xenon is offline
 
Join Date: Oct 2001
Location: Bavaria
Posts: 12,878
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

hmm, but i think you cannot do anything against.

as i said before the str_replace function is executet just 20times/post
but if someone uses the same smilie 1000 times or more often it's the str_replace function which increases the server-time.
so i'd say the problem is php not vb
Reply With Quote
  #12  
Old 07-25-2002, 10:33 AM
Sparkz's Avatar
Sparkz Sparkz is offline
 
Join Date: Nov 2001
Posts: 544
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

I have confirmed this myself too... I basicly put 10000 bytes of smiles (ie 5000 smilies) into a new post... It loads for a while and then it just stops loading. Nothing happens...

I even tried letting PHP use up to 75MB of ram, and 120 max execution time.
Reply With Quote
  #13  
Old 07-25-2002, 10:45 AM
Sparkz's Avatar
Sparkz Sparkz is offline
 
Join Date: Nov 2001
Posts: 544
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

This board handled it easily, though...
https://vborg.vbsupport.ru/showthrea...threadid=41507

That post WILL most likely bog your browser down for a little while...
Reply With Quote
  #14  
Old 07-25-2002, 11:46 AM
Scott MacVicar Scott MacVicar is offline
 
Join Date: Oct 2001
Location: Glasgow, Scotland
Posts: 1,199
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Yeah it took a whole 4 seconds to load
Reply With Quote
  #15  
Old 07-26-2002, 07:05 AM
Logician's Avatar
Logician Logician is offline
 
Join Date: Nov 2001
Location: inside vb code
Posts: 4,449
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Here is a fix for you:

edit function.php, find:

PHP Code:
 $bbcode=str_replace(trim($smilie[smilietext]),"<img src=\"$smilie[smiliepath]\" border=\"0\" alt=\"\">",$bbcode); 
Before that add:

PHP Code:
if (substr_count($bbcodetrim($smilie[smilietext]))>1000
{
// do something bad to the spammer like automatically changing his usergroup to banned members
// notify admin about his malicious behaviour etc.
// then exit in peace.. ;-)
exit;

You can change 1000 with any numbers your server can handle.. This code will first count the smilie number in the post before attempting to process (replace) them and if the number is too high, it will exit and not let str_replace to run to get the server on its knees. FYI "substr_count" works VERY FAST so you dont need to worry about its performance..

BTW congratulate your "bored" members for me, it was a good catch..

Enjoy..
Logician
Reply With Quote
  #16  
Old 07-26-2002, 09:41 AM
JJR512's Avatar
JJR512 JJR512 is offline
 
Join Date: Oct 2001
Location: Glen Burnie, MD, USA
Posts: 710
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Using Logician's idea, here's what I used:
PHP Code:
if (substr_count($bbcodetrim($smilie[smilietext]))>50) {
  eval(
"standarderror(\"".gettemplate("error_toomanyimages")."\");");
  exit;

I didn't want to automatically ban the member or anything, in case it was an honest mistake. And I only used 50, because I have a low max image setting, anyway.
Reply With Quote
  #17  
Old 07-26-2002, 10:36 AM
Xenon's Avatar
Xenon Xenon is offline
 
Join Date: Oct 2001
Location: Bavaria
Posts: 12,878
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

normally then you should use that:
PHP Code:
if (substr_count($bbcodetrim($smilie[smilietext]))>$maximages) {
  eval(
"standarderror(\"".gettemplate("error_toomanyimages")."\");");
  exit;

good idea logician
Reply With Quote
  #18  
Old 07-26-2002, 11:06 AM
Kaelon's Avatar
Kaelon Kaelon is offline
 
Join Date: Jan 2002
Posts: 405
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Thanks, Logician!

Only problem - I tried using

PHP Code:
if (substr_count($bbcodetrim($smilie[smilietext]))>$maximages) {
          eval(
"standarderror(\"".gettemplate("error_toomanyimages")."\");");
        exit;

But even if I inserted one smiley, the error_toomanyimages template would be displayed. When I hardcoded "10" instead of $maximages, everything seemed to work fine.

Thanks again, gang.

Kaelon
Reply With Quote
  #19  
Old 07-26-2002, 11:11 AM
Xenon's Avatar
Xenon Xenon is offline
 
Join Date: Oct 2001
Location: Bavaria
Posts: 12,878
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

oh sorry that was my fault

a few lines above you find this code:
PHP Code:
global $DB_site,$wordwrap,$allowdynimg$bbuserinfo
replace it with
PHP Code:
global $DB_site,$wordwrap,$allowdynimg$bbuserinfo,$maximages
Reply With Quote
  #20  
Old 07-26-2002, 07:09 PM
Danny Danny is offline
 
Join Date: Dec 2001
Posts: 40
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally posted by Logician
Here is a fix for you:

edit function.php, find:

PHP Code:
 $bbcode=str_replace(trim($smilie[smilietext]),"<img src=\"$smilie[smiliepath]\" border=\"0\" alt=\"\">",$bbcode); 
Before that add:

PHP Code:
if (substr_count($bbcodetrim($smilie[smilietext]))>1000
{
// do something bad to the spammer like automatically changing his usergroup to banned members
// notify admin about his malicious behaviour etc.
// then exit in peace.. ;-)
exit;

where exactly am i looking for this? cause there is no function.php file only admin/functions.php and its not in that file.

i am using vb 2.2.6 btw.
Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 05:35 PM.


Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.
X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.04384 seconds
  • Memory Usage 2,283KB
  • Queries Executed 13 (?)
More Information
Template Usage:
  • (1)SHOWTHREAD
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)ad_showthread_beforeqr
  • (1)ad_showthread_firstpost
  • (1)ad_showthread_firstpost_sig
  • (1)ad_showthread_firstpost_start
  • (9)bbcode_php
  • (1)bbcode_quote
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)navbar
  • (3)navbar_link
  • (120)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (3)pagenav_pagelink
  • (10)post_thanks_box
  • (10)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (10)post_thanks_postbit_info
  • (10)postbit
  • (10)postbit_onlinestatus
  • (10)postbit_wrapper
  • (1)spacer_close
  • (1)spacer_open
  • (1)tagbit_wrapper 

Phrase Groups Available:
  • global
  • inlinemod
  • postbit
  • posting
  • reputationlevel
  • showthread
Included Files:
  • ./showthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/functions_bigthree.php
  • ./includes/class_postbit.php
  • ./includes/class_bbcode.php
  • ./includes/functions_reputation.php
  • ./includes/functions_post_thanks.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_postinfo_query
  • fetch_postinfo
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • showthread_start
  • showthread_getinfo
  • forumjump
  • showthread_post_start
  • showthread_query_postids
  • showthread_query
  • bbcode_fetch_tags
  • bbcode_create
  • showthread_postbit_create
  • postbit_factory
  • postbit_display_start
  • post_thanks_function_post_thanks_off_start
  • post_thanks_function_post_thanks_off_end
  • post_thanks_function_fetch_thanks_start
  • post_thanks_function_fetch_thanks_end
  • post_thanks_function_thanked_already_start
  • post_thanks_function_thanked_already_end
  • fetch_musername
  • postbit_imicons
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_display_complete
  • post_thanks_function_can_thank_this_post_start
  • pagenav_page
  • pagenav_complete
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete