vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vBulletin 3.5 Add-ons (https://vborg.vbsupport.ru/forumdisplay.php?f=113)
-   -   [AJAX] Post Thank You Hack (https://vborg.vbsupport.ru/showthread.php?t=92410)

D.Ilyin 02-11-2006 03:16 PM

and i have the same error when click THANKS:
Quote:

Database error in vBulletin 3.5.3:

Invalid SQL:

UPDATE user
SET post_thanks_thanked_times = 1 + post_thanks_thanked_times, post_thanks_thanked_posts = 1 + post_thanks_thanked_posts, reputation = $vboptions[post_thanks_reputation] + reputation
WHERE userid = 38210;

MySQL Error : 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 '[post_thanks_reputation] + reputation
WHERE userid = 38210' at line 2

Abe1 02-11-2006 10:06 PM

Version 3.1 (2/11/06):
  • [FIXED] Fixed bug with reputation.

AnhTuanCool 02-12-2006 02:16 AM

Hey Abe1,

Although the showthread page uses only ONE query, the load seems yet to loose.

I've attached the query exp of one normal thread on my forum. One post got thanked 13 times and it took almost 10 sec to query!
https://vborg.vbsupport.ru/

Abe1 02-12-2006 02:30 AM

Quote:

Originally Posted by AnhTuanCool
Hey Abe1,

Although the showthread page uses only ONE query, the load seems yet to loose.

I've attached the query exp of one normal thread on my forum. One post got thanked 13 times and it took almost 10 sec to query!
http://img147.imageshack.us/img147/889/qhev6tk.th.jpg

This is what I got on my forum:

Time Before: 0.13631 seconds
Time After: 0.13647 seconds
Time Taken: 0.00016 seconds

AnhTuanCool 02-12-2006 02:53 AM

Ahhhhh, I think I've made a terrible mistake here.

I figured out what the problem is that the mixing query I suggested awhile ago actually makes the hack's query time worse. When using multiple WHERE's in query, it queries ALL the entries out of the table and the filter it through the second WHERE. If there are a lot of thanks entries like mine, it tremendously stresses the server. Look at the image I attached above, at column Row and you'll understand why.

So I strongly recommend switch back to the old time query.
Code:

$post_thanks_querys = $db->query("SELECT postid FROM ". TABLE_PREFIX ."post WHERE threadid = '$post[threadid]'");
    $post_thanks_postids = 0;
   
    while ($post_thanks_query = $db->fetch_array($post_thanks_querys))
    {
      $post_thanks_postids .= ",$post_thanks_query[postid]";
    }

    $post_thanks_cashe = $db->query("SELECT * FROM " .TABLE_PREFIX. "post_thanks WHERE postid IN ($post_thanks_postids) ORDER BY username ASC");

Lastly, I terribly sorry for suggesting such a flawful mod...

dai-kun 02-12-2006 06:06 AM

For some reason, as soon as I enable this product, my server load spike up to 10-20... why is that?
I have a lot of members online (around 200 at the same time) and a lot of thanked posts.
I'm using the latest version.

As soon as I disable this, server load goes back to normal (1-3).

NeutralizeR 02-12-2006 12:43 PM

Can't remove thanks.

Quote:

Database error in vBulletin 3.5.3:

Invalid SQL:
DELETE FROM msx_reputation WHERE postid = 62668 AND AND whoadded = 1 reason = 'Teşekk?r Mesajı';

MySQL Error : 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 whoadded = 1 reason = 'Teşekk?r Mesajı'' at line 1
Error Number : 1064
Quote:

Database error in vBulletin 3.5.3:

Invalid SQL:

UPDATE msx_user
SET post_thanks_user_amount = post_thanks_user_amount - 1
WHERE userid IN ();

MySQL Error : 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 3 Error Number : 1064

dai-kun 02-12-2006 04:59 PM

Quote:

Originally Posted by AnhTuanCool
Ahhhhh, I think I've made a terrible mistake here.

I figured out what the problem is that the mixing query I suggested awhile ago actually makes the hack's query time worse. When using multiple WHERE's in query, it queries ALL the entries out of the table and the filter it through the second WHERE. If there are a lot of thanks entries like mine, it tremendously stresses the server. Look at the image I attached above, at column Row and you'll understand why.

So I strongly recommend switch back to the old time query.
Code:

$post_thanks_querys = $db->query("SELECT postid FROM ". TABLE_PREFIX ."post WHERE threadid = '$post[threadid]'");
    $post_thanks_postids = 0;
   
    while ($post_thanks_query = $db->fetch_array($post_thanks_querys))
    {
      $post_thanks_postids .= ",$post_thanks_query[postid]";
    }

    $post_thanks_cashe = $db->query("SELECT * FROM " .TABLE_PREFIX. "post_thanks WHERE postid IN ($post_thanks_postids) ORDER BY username ASC");

Lastly, I terribly sorry for suggesting such a flawful mod...


Thanks, I've revert it back toversion 2.5 and the server load seems to be less than 3-4 now :D
Before it was 20-30

edit:

nvm.. it's fluctuating now.. going around 6-15

AnhTuanCool 02-12-2006 07:14 PM

@dai-kun - Did you delete this line in the hook?
Code:

    $post_thanks_cashe = $db->query("SELECT " . TABLE_PREFIX . "post_thanks.* FROM " . TABLE_PREFIX . "post_thanks, " . TABLE_PREFIX . "post WHERE " . TABLE_PREFIX . "post.postid = " . TABLE_PREFIX . "post_thanks.postid AND " . TABLE_PREFIX . "post.threadid = '$post[threadid]' ORDER BY " . TABLE_PREFIX . "post_thanks.username ASC");
If you didn't, please do so. It's the main problem source.

dai-kun 02-12-2006 11:54 PM

Ok so how would I do this? Do I edit out that code in the 3.0 version? I tried that and it giving me errors.

Cam on.

PHP Code:

global $post_thanks_cash$post_thanks_done$db;

if (empty(
$post_thanks_done))
{

    
$act 1;

    while (
$thanks $db->fetch_array($post_thanks_cashe))
    {
        
$post_thanks_cash[$act][userid] = "$thanks[userid]";
        
$post_thanks_cash[$act][username] = "$thanks[username]";
        
$post_thanks_cash[$act][date] = "$thanks[date]";
        
$post_thanks_cash[$act][postid] = "$thanks[postid]";
        
$act ++;
    } 



All times are GMT. The time now is 09:04 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.01901 seconds
  • Memory Usage 1,761KB
  • 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
  • (3)bbcode_code_printable
  • (1)bbcode_php_printable
  • (5)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (4)pagenav_pagelink
  • (3)pagenav_pagelinkrel
  • (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