vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB3 General Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=111)
-   -   Excessive Smilies overloading Servers (https://vborg.vbsupport.ru/showthread.php?t=41281)

Xenon 07-25-2002 10:15 AM

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

Sparkz 07-25-2002 10:33 AM

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.

Sparkz 07-25-2002 10:45 AM

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...

Scott MacVicar 07-25-2002 11:46 AM

Yeah it took a whole 4 seconds to load :(

Logician 07-26-2002 07:05 AM

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

JJR512 07-26-2002 09:41 AM

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.

Xenon 07-26-2002 10:36 AM

normally then you should use that:
PHP Code:

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


good idea logician :)

Kaelon 07-26-2002 11:06 AM

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

Xenon 07-26-2002 11:11 AM

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


Danny 07-26-2002 07:09 PM

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.


All times are GMT. The time now is 07:03 AM.

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.01128 seconds
  • Memory Usage 1,758KB
  • Queries Executed 10 (?)
More Information
Template Usage:
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (9)bbcode_php_printable
  • (1)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (3)pagenav_pagelink
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (10)printthreadbit
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • showthread
Included Files:
  • ./printthread.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/class_bbcode_alt.php
  • ./includes/class_bbcode.php
  • ./includes/functions_bigthree.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • printthread_start
  • pagenav_page
  • pagenav_complete
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete