vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vBulletin 3.0 Full Releases (https://vborg.vbsupport.ru/forumdisplay.php?f=33)
-   -   Advanced Warning System (AWS) (https://vborg.vbsupport.ru/showthread.php?t=71992)

sv1cec 01-11-2005 04:33 AM

Quote:

Originally Posted by rinkrat
Jeez, now I'm getting this when I try and warn someone from admincp

Database error in vBulletin 3.0.5:

Invalid SQL: insert into warnings values('','8449','1','1105418299','test','','1','N ','A','','')
mysql error: Column count doesn't match value count at row 1

mysql error number: 1136

Date: Monday 10th of January 2005 08:38:19 PM
Script: http://www.letsgokings.com/bbs/Warn.php
Referer: http://www.letsgokings.com/bbs/Warn....n=user&id=8449
Username: RinkRat
IP Address: 66.214.41.130

Strange, this error shows the proper columns OK. What is the description of your warnings table? Run this query and post your results here:

DESCRIBE warnings

Rgds

sv1cec 01-11-2005 04:38 AM

Quote:

Originally Posted by PKRWUD
That's pretty much what I figured, but my coding skills don't really exist, I'm an engine man. lol. What is the proper syntax for adding two user groups together like you are suggesting? I'm not asking for the whole code, but do I write "$bbuserinfo[usergoupid]==6, $bbuserinfo[usergoupid]==13" or "$bbuserinfo[usergoupid]==6 and $bbuserinfo[usergoupid]==13", etc. ? What's the proper way to write it out so that the browser recognizes those two go together?

It depends on the statement. Most of the times, it should be OR, like :

HTML Code:

<if condition="$bbuserinfo[usergroupid]==6">
  do this
</if>

should be converted to :

HTML Code:

<if condition="$bbuserinfo[usergroupid]==6 OR $bbuserinfo[usergroupid]==13">
  do this
</if>

Rgds

rinkrat 01-11-2005 05:17 AM

Quote:

Originally Posted by sv1cec
Strange, this error shows the proper columns OK. What is the description of your warnings table? Run this query and post your results here:

DESCRIBE warnings

Rgds


Code:

Host: localhost
Database : lgk2
Generation Time: Jan 10, 2005 at 11:14 PM
Generated by: phpMyAdmin 2.6.0-alpha2 / MySQL 4.0.15-standard
SQL-query: DESCRIBE warnings;
Rows: 10
Field        Type        Null        Key        Default        Extra
wid        int(15)                  PRI        NULL        auto_increment
warned_user        int(15)                            0         
warned_by        int(15)                            0         
warned_time        int(15)                            0         
warned_reason        text                                       
warned_post        int(15)                            0         
warned_warning_id        int(15)                            0         
warned_status        char(1)        YES                  NULL         
removed_by        int(15)        YES                  NULL         
removed_date        int(15)        YES                  NULL


sv1cec 01-11-2005 06:25 AM

Quote:

Originally Posted by rinkrat
Code:

Host: localhost
Database : lgk2
Generation Time: Jan 10, 2005 at 11:14 PM
Generated by: phpMyAdmin 2.6.0-alpha2 / MySQL 4.0.15-standard
SQL-query: DESCRIBE warnings;
Rows: 10
Field        Type        Null        Key        Default        Extra
wid        int(15)                  PRI        NULL        auto_increment
warned_user        int(15)                            0         
warned_by        int(15)                            0         
warned_time        int(15)                            0         
warned_reason        text                                       
warned_post        int(15)                            0         
warned_warning_id        int(15)                            0         
warned_status        char(1)        YES                  NULL         
removed_by        int(15)        YES                  NULL         
removed_date        int(15)        YES                  NULL


Rinkrat,

That does not make sense. Your table has the right columns, the SQL statement is trying to insert the right number of values, what on earth is this? Here is my warnings table description:

HTML Code:

wid          int(15)                    PRI                    auto_increment
warned_user        int(15)                            0         
warned_by        int(15)                            0         
warned_time        int(15)                            0         
warned_reason        text                                       
warned_post        int(15)                            0         
warned_warning_id        int(15)                            0         
caused_ban        char(1)        YES                             
warned_status        char(1)        YES                             
removed_by        int(15)        YES                             
removed_date        int(15)        YES

Exactly the same as yours. And at that part of the code, the hack is using Warn.php routines, which should be fine, since they work OK here, and I assume with others, because no one has complained about it.

Do me a favor, try to add a non-post related warning from a user's public profile. See if that produces the same error.

Rgds

rinkrat 01-11-2005 07:26 AM

OK here it is.


Code:

Database error in vBulletin 3.0.5:

Invalid SQL: insert into warnings values('','145','1','1105435458','Ignore this I'm just testing','','1','N','A','','')
mysql error: Column count doesn't match value count at row 1

mysql error number: 1136

Date: Tuesday 11th of January 2005 01:24:18 AM
Script: http://www.letsgokings.com/bbs/Warn.php
Referer: http://www.letsgokings.com/bbs/Warn.php?do=WarnUserNoPost&return=user&id=145
Username: RinkRat
IP Address: 66.214.41.130


OK I just tried a warning from a thread and got this

Code:

Database error in vBulletin 3.0.5:

Invalid SQL: insert into warnings values('','1742','1','1105435656','Just testing ignore this.','809396','11','N','A','','')
mysql error: Column count doesn't match value count at row 1

mysql error number: 1136

Date: Tuesday 11th of January 2005 01:27:36 AM
Script: http://www.letsgokings.com/bbs/Warn.php
Referer: http://www.letsgokings.com/bbs/Warn.php?do=WarnUser&id=1742&post=809396
Username: RinkRat
IP Address: 66.214.41.130

I might have screwed up the edits (there were a lot) but I was really careful. Maybe I'll try it all over again.

sv1cec 01-11-2005 07:53 AM

Quote:

Originally Posted by rinkrat
OK here it is.


Code:

Database error in vBulletin 3.0.5:

Invalid SQL: insert into warnings values('','145','1','1105435458','Ignore this I'm just testing','','1','N','A','','')
mysql error: Column count doesn't match value count at row 1

mysql error number: 1136

Date: Tuesday 11th of January 2005 01:24:18 AM
Script: http://www.letsgokings.com/bbs/Warn.php
Referer: http://www.letsgokings.com/bbs/Warn.php?do=WarnUserNoPost&return=user&id=145
Username: RinkRat
IP Address: 66.214.41.130


OK I just tried a warning from a thread and got this

Code:

Database error in vBulletin 3.0.5:

Invalid SQL: insert into warnings values('','1742','1','1105435656','Just testing ignore this.','809396','11','N','A','','')
mysql error: Column count doesn't match value count at row 1

mysql error number: 1136

Date: Tuesday 11th of January 2005 01:27:36 AM
Script: http://www.letsgokings.com/bbs/Warn.php
Referer: http://www.letsgokings.com/bbs/Warn.php?do=WarnUser&id=1742&post=809396
Username: RinkRat
IP Address: 66.214.41.130

I might have screwed up the edits (there were a lot) but I was really careful. Maybe I'll try it all over again.

OK, let's do this test. Open your includes/functions_warning.php file and find:

PHP Code:

$DB_site->query("insert into ".TABLE_PREFIX."warnings values('','{$user['userid']}','{$bbuser}','".time()."','{$wcomment}','{$wpost}','{$warn_type['tid']}','N','A','','')"); 

Replace that line with:

PHP Code:

$DB_site->query("insert into ".TABLE_PREFIX."warnings (wid, warned_user, warned_by, warned_time, warned_reason, warned_post, warned_warning_id, caused_ban, warned_status, removed_by, removed_date) values('','{$user['userid']}','{$bbuser}','".time()."','{$wcomment}','{$wpost}','{$warn_type['tid']}','N','A','','')"); 

See if that works OK.

Rgds

PKRWUD 01-11-2005 09:35 AM

Quote:

Originally Posted by sv1cec
It depends on the statement. Most of the times, it should be OR, like :

HTML Code:

<if condition="$bbuserinfo[usergroupid]==6">
  do this
</if>

should be converted to :

HTML Code:

<if condition="$bbuserinfo[usergroupid]==6 OR $bbuserinfo[usergroupid]==13">
  do this
</if>

Rgds



Well, it took a little trial and error, but I got it to work. If you're interested, the code I used follows...

Again, Admin is 6 & 13, Super Mods are 5 & 21, and Mods are 7 & 20:

HTML Code:

<if condition="$hierarchical=='Yes'">
        <if condition="($post[usergroupid]!=6 AND $post[usergroupid]!=5 AND $post[usergroupid]!=7 AND can_moderate($forum[forumid], '', $bbuserinfo[userid])) OR ($post[usergroupid]==7 AND can_moderate($forum[forumid], '', $bbuserinfo[userid]) AND $bbuserinfo[usergroupid]==5) OR
        ($bbuserinfo[usergroupid]==6 AND $post[usergroupid]!=6) OR ($post[usergroupid]!=13 AND $post[usergroupid]!=21 AND $post[usergroupid]!=20 AND can_moderate($forum[forumid], '', $bbuserinfo[userid])) OR ($post[usergroupid]==20 AND can_moderate($forum[forumid], '', $bbuserinfo[userid]) AND $bbuserinfo[usergroupid]==21) OR
        ($bbuserinfo[usergroupid]==13 AND $post[usergroupid]!=13)
"
>

        <a href='Warn.php?do=WarnUser&id=$post[userid]&post=$post[postid]'>Warn $post[username]</a> ?
        </if>
        <if condition="($post[usergroupid]!=6 AND $post[usergroupid]!=5 AND $post[usergroupid]!=7 AND ($bbuserinfo[usergroupid]==7 OR $bbuserinfo[usergroupid]==5)) OR ($post[usergroupid]==7 AND $bbuserinfo[usergroupid]==5) OR ($bbuserinfo[usergroupid]==6 AND $post[usergroupid]!=6) OR ($post[usergroupid]!=13 AND $post[usergroupid]!=21 AND $post[usergroupid]!=20 AND ($bbuserinfo[usergroupid]==20 OR $bbuserinfo[usergroupid]==21)) OR ($post[usergroupid]==20 AND $bbuserinfo[usergroupid]==21) OR ($bbuserinfo[usergroupid]==13 AND $post[usergroupid]!=13)">
        <a href='Warn.php?do=ViewWarnings&id=$post[userid]'>View $post[username]'s Warnings</a> ?
        </if>
        <if condition="($post[userid]==$bbuserinfo[userid] AND $post[usergroupid]!=6 AND $post[warning_level]>0) OR ($post[userid]==$bbuserinfo[userid] AND $post[usergroupid]!=13 AND $post[warning_level]>0)">
        <a href='Warn.php?do=ViewMyWarnings'>View your Warnings</a> ?
        </if>
</if>
</if>

<!-- end of warning system -->


sv1cec 01-11-2005 09:40 AM

Quote:

Originally Posted by PKRWUD
Well, it took a little trial and error, but I got it to work. If you're interested, the code I used follows...

Again, Admin is 6 & 13, Super Mods are 5 & 21, and Mods are 7 & 20:

HTML Code:

<if condition="$hierarchical=='Yes'">
        <if condition="($post[usergroupid]!=6 AND $post[usergroupid]!=5 AND $post[usergroupid]!=7 AND can_moderate($forum[forumid], '', $bbuserinfo[userid])) OR ($post[usergroupid]==7 AND can_moderate($forum[forumid], '', $bbuserinfo[userid]) AND $bbuserinfo[usergroupid]==5) OR
        ($bbuserinfo[usergroupid]==6 AND $post[usergroupid]!=6) OR ($post[usergroupid]!=13 AND $post[usergroupid]!=21 AND $post[usergroupid]!=20 AND can_moderate($forum[forumid], '', $bbuserinfo[userid])) OR ($post[usergroupid]==20 AND can_moderate($forum[forumid], '', $bbuserinfo[userid]) AND $bbuserinfo[usergroupid]==21) OR
        ($bbuserinfo[usergroupid]==13 AND $post[usergroupid]!=13)
"
>

        <a href='Warn.php?do=WarnUser&id=$post[userid]&post=$post[postid]'>Warn $post[username]</a> ?
        </if>
        <if condition="($post[usergroupid]!=6 AND $post[usergroupid]!=5 AND $post[usergroupid]!=7 AND ($bbuserinfo[usergroupid]==7 OR $bbuserinfo[usergroupid]==5)) OR ($post[usergroupid]==7 AND $bbuserinfo[usergroupid]==5) OR ($bbuserinfo[usergroupid]==6 AND $post[usergroupid]!=6) OR ($post[usergroupid]!=13 AND $post[usergroupid]!=21 AND $post[usergroupid]!=20 AND ($bbuserinfo[usergroupid]==20 OR $bbuserinfo[usergroupid]==21)) OR ($post[usergroupid]==20 AND $bbuserinfo[usergroupid]==21) OR ($bbuserinfo[usergroupid]==13 AND $post[usergroupid]!=13)">
        <a href='Warn.php?do=ViewWarnings&id=$post[userid]'>View $post[username]'s Warnings</a> ?
        </if>
        <if condition="($post[userid]==$bbuserinfo[userid] AND $post[usergroupid]!=6 AND $post[warning_level]>0) OR ($post[userid]==$bbuserinfo[userid] AND $post[usergroupid]!=13 AND $post[warning_level]>0)">
        <a href='Warn.php?do=ViewMyWarnings'>View your Warnings</a> ?
        </if>
</if>
</if>

<!-- end of warning system -->


Just wish that this is the only place that you have to change the code for your situation. I just can't check where you need to make this change to make the hack safe for your condition.

One thing I would suggest, is to avoid using the Hierarchical Schema, and declare those additional user groups, as protected user groups, so that they can't be warned. I know that not using the hierarchical schema reduces the functionality, in the sense that a super mod cannot warn a moderator, but it also simplifies things, which in your case is something you would like.

Correction: This solves your Warn sign issue. But it does not solve the hack's operation issues. There are more places where you have to do the same changes, like for example, when the "Warn XYZ" and "View XYZ's Warnings". The code there also uses the group information to decide if the links should be visible or not. Also, in the place where the warning points and the number of bans is shown.

It's none of my business of course, but why are you using two groups for each role?

Rgds


Rgds

Revan 01-11-2005 09:50 AM

Quote:

Originally Posted by rinkrat
OK here it is.


Code:

Database error in vBulletin 3.0.5:

Invalid SQL: insert into warnings values('','145','1','1105435458','Ignore this I'm just testing','','1','N','A','','')
mysql error: Column count doesn't match value count at row 1

mysql error number: 1136

Date: Tuesday 11th of January 2005 01:24:18 AM
Script: http://www.letsgokings.com/bbs/Warn.php
Referer: http://www.letsgokings.com/bbs/Warn.php?do=WarnUserNoPost&return=user&id=145
Username: RinkRat
IP Address: 66.214.41.130


That there looks like a missing addslashes()
Just throwing the few cents I got about this out there :)

PKRWUD 01-11-2005 10:07 AM

Quote:

Originally Posted by sv1cec
Correction: This solves your Warn sign issue. But it does not solve the hack's operation issues. There are more places where you have to do the same changes, like for example, when the "Warn XYZ" and "View XYZ's Warnings". The code there also uses the group information to decide if the links should be visible or not. Also, in the place where the warning points and the number of bans is shown.

It's none of my business of course, but why are you using two groups for each role?

Rgds


I was going to say I noticed that the Warnings by Warners Statistic doesn't list anyone in the other three usergroups. If you get a chance, and have the time, I'd appreciate it if you could note where else I will need to make changes.

I first tried adding an "OR" to each one, followed by it's counterpart, but that made it possible for all the staff to warn in every forum, and allowed the members to see the links. The way it is now, every staff member can see the WARN image, and the view links, but only the super mod, admin, and the specific mod for that forum can see and use the warn links. It may not be right, but so far, I absolutely love it. It took me a couple hours to install it, but I haven't received a single error message yet, and for me, that's an accomplishment worth celebrating. :)

The two Admin usergroups are for webmaster and admin, which have slightly different abilities, but are still both admin. The rest of the usergroups were doubled a couple years ago when we decided to create a second usergroup for sponsoring members, sponsoring moderators, and sponsoring super mods, and everything has just been built around that ever since.

I'm sure there was/is an easier method, but I'm a mechanic, not a coder, and this stuff is as foreign to me as cooking. lol.


All times are GMT. The time now is 08:21 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.02124 seconds
  • Memory Usage 1,832KB
  • 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
  • (7)bbcode_code_printable
  • (7)bbcode_html_printable
  • (2)bbcode_php_printable
  • (9)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