vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   Modification Graveyard (https://vborg.vbsupport.ru/forumdisplay.php?f=224)
-   -   Administrative and Maintenance Tools - Troll/ip-tracker, detect multiple accounts/trolls [3.6 compatible] (https://vborg.vbsupport.ru/showthread.php?t=119695)

TMM-TT 07-31-2006 01:15 AM

Changes for 2.0.4 that will be released as soon the caches has been tested:
  • Using short-time cache to look for duplicates instead of scanning the whole database (based on cookietimeout)
  • The above cache is used with the whos online-list too
  • Added cache for alerts so reports only will be sent on changes in the usernames
  • 2 phrases fixed
  • Added username exclusions (usernames/userids that won't be blocked)
  • Fixed the SHOW COLUMNS-problem in iptracker.php


If someone thinks that I have forgotten something, please tell me. :)

Alfa1 07-31-2006 01:40 PM

Quote:

Originally Posted by TMM-TT
  1. Joe is banned
  2. The tracker see that Joe is banned and blocks him from the forum
  3. Joe try to log out by cleaning up the cookies
  4. The tracker compares the ip to the banlist and see that there is a guest using Joes ip.. He gets blocked as guest also
  5. Three days later, Joes ip is changed and he can log in as a guest again. He knows that hes banned so he use another nickname instead, that he registered after 'Joe'. He logs in as 'Jim'
  6. The tracker checks the database and find that Joe is linked to Jim
  7. The tracker checks with the userban-list and find that Joe is banned
  8. Jim, Joe and the new ip is now locked out


The blacklisting option means that if any guest is matched with a banned user the ip will be blocked from the forum even before login. If 'Jim' is a shared "troll"-account this also means that all users logged in as Jim, will be locked out of the forum because Joe is linked to the same nick - and banned.

The blacklist in options->userbanning only stops specific ip-addresses, which means that if Joe goes to his parents he's able to see the forum as a guest (until he tries to login as Joe again). If you use the built-in blacklist and using parts of the ip the risk is that you ban a bunch of other users that is using the same subnet. :)

Wouldn't this block out dial up users and users on providers like aol? (banning one AOL IP affects a whole range of AOL IP's, because of the way AOL's network works)

Alfa1 07-31-2006 06:13 PM

After a month of use, I experienced these errors:
Quote:

Invalid SQL:
SELECT * from vb9_user_troll WHERE userid = '0' AND realip = 'xxx' ORDER BY timestamp DESC LIMIT 1;

MySQL Error : Lost connection to MySQL server during query
Error Number : 2013
Quote:

Invalid SQL:
SELECT COUNT(*) AS trolledlinks FROM vb9_user_troll WHERE userlink = '0';

MySQL Error : Server shutdown in progress
Error Number : 1053
Quote:

Invalid SQL:
UPDATE vb9_user_troll SET userlink = '3423' WHERE idx = '153' LIMIT 1;

MySQL Error : Server shutdown in progress
Error Number : 1053
Quote:

Invalid SQL:
UPDATE vb9_user_troll SET timestamp = 1153908011, date = '%2006-%07-%26', username = 'Unregistered', userid = '0', time = '%11:%Jul:%th', opm = '0' WHERE idx = '37650' LIMIT 1;

MySQL Error : Server shutdown in progress
Error Number : 1053
Quote:

Invalid SQL:
SELECT userid,realip,timestamp from vb9_user_troll WHERE userid > 0 AND realip = 'xxx' ORDER by timestamp DESC, userid ASC LIMIT 1;

MySQL Error : Server shutdown in progress
Error Number : 1053
Quote:

Invalid SQL:
UPDATE vb9_user_troll SET timestamp = 1152565757, date = '%2006-%07-%10', username = 'Jack's Seratonin', userid = '0', time = '%22:%Jul:%th', opm = '0' WHERE idx = '21475' LIMIT 1;

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 's Seratonin', userid = '0', time = '%22:%Jul:%th', opm = '0' WHE
Error Number : 1064
Note that the username was jack's serotonine. This error occurs many times where usernames include this symbol: '

I've got many more, but they are variations on the same.

TMM-TT 08-01-2006 12:00 PM

Quote:

Originally Posted by Alfa1
Wouldn't this block out dial up users and users on providers like aol? (banning one AOL IP affects a whole range of AOL IP's, because of the way AOL's network works)


Yes, but blocking users is optional and can be turned off. I only block specific usernames myself but the function is there for paranoid admins ;)


Quote:

Originally Posted by Alfa1
Note that the username was jack's serotonine. This error occurs many times where usernames include this symbol: '

Thanks, it should be fixed in next version. Interesting also, is that entry (time = '%22:%Jul:%th'). The time isn't correct there and I use strftime in the plugin. Maybe I should look for some other function for that part (I remember that vbdate didn't work).

(I still cant reproduce the problem you have there with server shutdowns. If someone have a tip there, why the error shows up, I would be very happy.)

Ski-Whiz 08-26-2006 08:34 PM

Ok I have found a bug:

Code:

Invalid SQL:
UPDATE user_troll SET timestamp = 1156627674, date = '2006-08-26', username =
'dabear's are #1', userid = '0', time = '17:27:54', opm = '0', imported = 0 WHERE
idx = '9830' AND deleted = 0 AND fqdn = 0 LIMIT 1;

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 's are
#1', userid = '0', time = '17:27:54', opm = '0', imported = 0 WHERE idx = ' at line
1
Error Number : 1064
Date        : Saturday, August 26th 2006 @ 05:27:54 PM
Script      : http://www.xxxxxxx.com/forums/register.php

Now this error is from anyone who uses an apostrophe in their username. The name I tried to register is "dabear's are #1"

This leaves us all open to a SQL attack..

TMM-TT 09-19-2006 10:00 AM

I apologize for the big delay on this hack. Too much things are happening around me so I've lost a lot of time.. Hopefully I can release 2.0.4 as soon as possible with a bunch of fixes.

As a notice - I've noticed (at least on my own server) that the function for showing trolls in the o Who's Online-listing lags me down a little bit sometimes. Probably that function depends on how many users online and how much the tracker has to look for. Without the extra cache there, I think the online-listing won't survive. :)


Quote:

Originally Posted by Ski-Whiz
Now this error is from anyone who uses an apostrophe in their username. The name I tried to register is "dabear's are #1"

This leaves us all open to a SQL attack..

That should hopefully be fixed too now. :)

TMM-TT 09-19-2006 10:07 AM

Because of the apostrophe-thing, I'll release this one now.. Here's the changelog -

2.0.4 [beta]
  • Using short-time cache to look for duplicates instead of scanning the whole database (based on cookietimeout)
  • The above cache is used with the whos online-list too
  • Added cache for alerts so reports only will be sent on changes in the usernames
  • 2 phrases fixed
  • Added username exclusions (usernames/userids that won't be blocked)
  • Fixed the SHOW COLUMNS-problem in iptracker.php
  • Fixed a serious injection problem

Alfa1 09-19-2006 02:44 PM

After upgrading this I get an error. I have tried uninstalling trolltracker and reinstalling it, but then I get this:

Database error in vBulletin 3.5.4:

Invalid SQL:

### INSERT QUERY GENERATED BY fetch_query_sql() ###
INSERT INTO vb4_plugin
(`active`, `executionorder`, `title`, `hookname`, `phpcode`, `product`)
VALUES
('1', '5', 'trolltracker_register', 'global_start', '// Note, this code has no version 1.0.0 released. The first version was private\r\n// and this one is the conversion.\r\n\r\n$dosavetroll = 1;\r\n\r\n// admincp settings\r\n// v1.0->2.0 and some addons\r\n$trollenabled = $vbulletin->options[\'trollenabled\'];\r\n\r\n// Something went wrong!\r\nif (!$_SERVER[\'REMOTE_ADDR\']) {$trollenabled = 0;}\r\n\r\nif ($trollenabled == 1) {\r\n$followtroll = $vbulletin->options[\'followtroll\'];\r\n$trolluseridlookup = $vbulletin->options[\'trolluserid\'];\r\n$trollunreg = $vbulletin->options[\'trollunreg\'];\r\n$trollignoreopm = $vbulletin->options[\'trollignoreopm\'];\r\n$trollwarnopm = $vbulletin->options[\'trollwarnopm\'];\r\n$trollsession = $vbulletin->options[\'trollsession\'];\r\n$trollblock = $vbulletin->options[\'trollblock\'];\r\n$trollblockuser = strtolower($vbulletin->options[\'trollblockuser\']);\r\n$trollexcludeuser = strtolower($vbulletin->options[\'trollexcludeuser\']);\r\n$trollblockusertrig = $vbulletin->options[\'trollblockusertrig\'];\r\n$trolladmin = $vbulletin->options[\'trolladmin\'];\r\n$trollcandelete = $vbulletin->options[\'trollcandelete\'];\r\n$trolluniqueheaders = $vbulletin->options[\'trolluniqueheaders\'];\r\n$trollalertuser = $vbulletin->options[\'trollalertuser\'];\r\n$trollalertforum = $vbulletin->options[\'trollalertforum\'];\r\n$trollalertafter = $vbulletin->options[\'trollalertafter\'];\r\n$trollonlineusers = $vbulletin->options[\'trollonlineusers\'];\r\n$trolldifftime = $vbulletin->options[\'trolldifftime\']*60*60;\r\n$trollalertfrom = $vbulletin->options[\'trollalertfrom\'];\r\n$trollFQDN = $vbulletin->options[\'trollFQDN\'];\r\n$trolluseFQDN = $vbulletin->options[\'trolluseFQDN\'];\r\n$trollautoblockBans = $vbulletin->options[\'trollautoblockBans\'];\r\n\r\n// Clean cacheResolver\r\n$cleanTrollResolver = TIMENOW - 21600;\r\n$vbulletin->db->query(\"DELETE FROM \" . TABLE_PREFIX . \"user_trollresolver WHERE dateline < $cleanTrollResolver\");\r\n\r\n// Who can use tracker...?\r\nglobal $istrolladmin, $istrolldelete, $vbulletin, $db, $vbphrase, $stylevar, $style;\r\n\r\n$trollgroups = explode(\',\',$vbulletin->options[trolladmin]); \r\nif (is_member_of($vbulletin->userinfo, $trollgroups)) $istrolladmin = true;\r\n\r\n// Who can manipulate the tracker?\r\n$trollcandeletegroups = explode(\',\',$vbulletin->options[trollcandelete]); \r\nif (is_member_of($vbulletin->userinfo, $trollcandeletegroups)) $istrolldelete = true;\r\n\r\nif ($istrolladmin == 1) {\r\n $show[\'trolltracker\'] = 1;\r\n if ($trollonlineusers) {$show[\'trolldata\'] = 1;}\r\n }\r\n\r\n/**** Userdata and browser stuff ****/\r\n// Reliable data to register\r\n// Note, addslashes is only needed on ONE $trollusername if we don\'t want a whole lot of dupes!\r\n$trollusername = addslashes($vbulletin->userinfo[\'username\']);\r\n$trolluserid = $vbulletin->userinfo[\'userid\'];\r\n$trollremote = $_SERVER[\'REMOTE_ADDR\'];\r\n$timestamp = TIMENOW;\r\n$trolldate = strftime(\'%Y-%m-%d\');\r\n$trolltime = strftime(\'%H:%M:%S\');\r\n\r\n\r\n// Unreliable data to save, but sometimes, still effective when trolls are using half-anonymous proxies\r\n$forwarded = $_SERVER[\'HTTP_X_FORWARDED_FOR\'];\r\n$via = $_SERVER[\'HTTP_VIA\'];\r\n\r\n// Don\'t overload the server with extra processes if not needed...\r\nif ($trollalertuser OR $trollalertforum OR $trollonlineusers == 1) {\r\n\r\n/**** COUNTING OF USER\'S NICKNAMES BEGIN (IF SELECTED FROM OPTIONS) ****/\r\n// Should only be enabled on request (alerting, blocking and \"self-notifying\")\r\n\r\n/** Check the cache for nicknames, so we don\'t have to query the big one **/\r\n// Clear old entries...\r\n$clearcachetime = TIMENOW - $vbulletin->options[cookietimeout];\r\n$vbulletin->db->query_write(\"DELETE FROM \" . TABLE_PREFIX . \"user_trollcache WHERE timestamp < \" . $clearcachetime);\r\n$trollcache = $vbulletin->db->query_first(\"SELECT * from \" . TABLE_PREFIX . \"user_trollcache WHERE realip = \'$trollremote\'\");\r\nif ($trollcache[nicks]) {\r\n $trollcachenicks = explode(\"\\n\", $trollcache[nicks]);\r\n foreach ($trollcachenicks as $nicks => $trollcachevalue) {\r\n // Must not be empty!\r\n if ($trollcachevalue) {\r\n $trollnicksUID[$vbulletin->userinfo[userid]] = $vbulletin->userinfo[userid];\r\n $trollnicksNAME[strtolower($trollcachevalue)] = strtolower($trollcachevalue);\r\n $trollnicksIP[$trollremote] = $trollremote;\r\n $trolls .= $trollcachevalue . \"\\n\";\r\n $linked++;\r\n }\r\n }\r\n}\r\n\r\n\r\n/** Check the cache for nicknames, so we don\'t have to query the big one --- DONE HERE **/\r\n// If this var is empty, we don\'t have anything cached.\r\n// Start caching only if this is no guest...\r\nif (!$trolls) {\r\n\r\n// This is a special thing that has to do with the guest vs logged when reporting.\r\n$getusernamedata = \"user.username = \'\" . addslashes($vbulletin->userinfo[username]) . \"\' OR \";\r\n// We don\'t want to include not logged in users in this report (because of the unregistered-name).\r\n// So we\'re removing it here instead of looking for unregged usernames in the database.\r\nif ($vbulletin->userinfo[userid] == 0) {$getusernamedata = \"\";}\r\n\r\n$lcountsql = \"SELECT DISTINCT users.userid,users.username,users.userlink,users.r ealip,users.timestamp,users.fo rwarded_for,users.http_via,user.userid\r\nFROM \" . TABLE_PREFIX . \"user_troll AS users\r\nINNER JOIN \" . TABLE_PREFIX . \"user_troll as user\r\nON (users.username = user.username)\r\nOR (users.userlink = user.userid AND users.userlink > 0)\r\nOR (users.realip = user.realip)\r\nOR (users.forwarded_for LIKE \'%$trollremote%\' AND users.forwarded_for != \'\')\r\nOR (users.http_via LIKE \'%$trollremote%\' AND users.http_via != \'\')\r\nWHERE user.userid > 0 AND users.userid > 0\r\nAND (\r\n $getusernamedata user.realip = \'$trollremote\'\r\n )\r\nAND user.deleted = 0\r\nAND users.deleted = 0\r\nAND user.fqdn = 0\r\nAND users.fqdn = 0\r\nGROUP by username\r\nORDER by timestamp DESC\r\n\";\r\n\r\n// Do not include FQDN-names into this listing - FQDN-names are not duplicate usernames, just identifiers\r\n$lcount = $vbulletin->db->query($lcountsql);\r\n\r\n// Collect nicknames to the dupechecker\r\n while ($trollArray = $vbulletin->db->fetch_array($lcount)) {\r\n\r\n // Must not be empty\r\n if ($trollArray[username]) {\r\n $trollnicksUID[$trollArray[userid]] = $trollArray[userid];\r\n $trollnicksNAME[strtolower($trollArray[username])] = strtolower($trollArray[username]);\r\n $trollnicksIP[$trollArray[realip]] = $trollArray[realip];\r\n\r\n if ($trollArray[userid] > 0) {$trolls .= $trollArray[username] . \"\\n\";}\r\n $linked++;\r\n }\r\n }\r\n\r\n\r\n// Fixes ontheirway! (060919)\r\n$trolls = addslashes($trolls);\r\n\r\n// If the own nick is missing, add it.\r\nif (!$trollnicksNAME[strtolower($trollusername)] AND $vbulletin->userinfo[userid] > 0) {$trolls .= $vbulletin->userinfo[username] . \"\\n\";}\r\n\r\n$vbulletin->db->query_write(\"INSERT INTO \" . TABLE_PREFIX . \"user_trollcache (userid, realip, nicks, timestamp) VALUES (\'\" . $vbulletin->userinfo[userid] . \"\', \'$trollremote\', \'$trolls\', \" . TIMENOW . \")\");\r\n\r\n} // End if cachevar\r\n\r\n}\r\n\r\n/**** COUNTING OF USER\'S NICKNAMES FINISH ****/\r\n\r\n\r\n/**** ALERT SECTION BEGIN ****/\r\n if (($trollalertuser OR $trollalertforum) AND $linked >= $trollalertafter AND $trollalertfrom > 0 AND $vbulletin->userinfo[userid] > 0) {\r\n // Used vars: $trollalertuser, $trollalertforum (Update database)\r\n\r\n $trolldupechanges = $vbulletin->db->query_first(\"SELECT * FROM \" . TABLE_PREFIX . \"user_trolldupes WHERE userid = \'\" . $vbulletin->userinfo[userid] . \"\' AND userid > 0\");\r\n\r\n if (!$trolldupechanges[nicklist]) {\r\n // Do not write guests into this list, that will cause trouble on reporting...\r\n if ($vbulletin->userinfo[userid] > 0) {\r\n $vbulletin->db->query_write(\"INSERT INTO \" . TABLE_PREFIX . \"user_trolldupes (userid, nicklist) VALUES (\'\" . $vbulletin->userinfo[userid] . \"\', \'\" . $trolls . \"\')\");\r\n }\r\n }\r\n\r\n // Report on changes...\r\n if ($trolls != $trolldupechanges[nicklist] AND $trolls) {\r\n $doreporttrolls = 1;\r\n\r\n // If there\'s an old nicklist, it\'s time to update here...\r\n if ($trolldupechanges[userid] == $vbulletin->userinfo[userid] AND $vbulletin->userinfo[userid] > 0 AND $trolldupechanges[userid] > 0) {\r\n $vbulletin->db->query_write(\"UPDATE \" . TABLE_PREFIX . \"user_trolldupes SET nicklist = \'$trolls\' WHERE userid = \'\" . $vbulletin->userinfo[userid] . \"\'\");\r\n }\r\n\r\n }\r\n\r\n$blockstatus = \"\";\r\n\r\n// Report normal blockings\r\nif ($linked >= $trollblock AND $trollblock > 0 AND $istrolladmin != 1 AND THIS_SCRIPT != \'iptracker.php\') {$blockstatus = $vbphrase[troll_report_blocked];}\r\n\r\n// Report bans\r\nif ($trollautoblockBans == 1 AND $forcetrollban == 1 AND $istrolladmin != 1 AND THIS_SCRIPT != \'iptracker.php\') {$blockstatus = $vbphrase[troll_report_banned];}\r\n\r\n if ($doreporttrolls == 1 AND $linked >= $trollalertafter) {\r\n $trollqueryuser = fetch_userinfo($trollalertfrom);\r\n\r\n $trollpm =& datamanager_init(\'PM\', $vbulletin, ERRTYPE_SILENT);\r\n // Send PM if options are set for PM\r\n if ($trollalertuser) {\r\n $trollpm->set(\'fromuserid\', $trollqueryuser[userid]);\r\n $trollpm->set(\'fromusername\', $trollqueryuser[username]);\r\n $trollpm->set_info(\'reciept\', false);\r\n $trollpm->set_info(\'savecopy\', false);\r\n $trollpm->set(\'title\', construct_phrase($vbphrase[troll_alertsubject], $vbulletin->userinfo[username]));\r\n $trollpm->set(\'message\', construct_phrase($vbphrase[troll_alertmessage], $vbulletin->userinfo[username], $trolls, $blockstatus));\r\n $trollpm->set_recipients($trollalertuser, $trollqueryuser[permissions]);\r\n $trollpm->set(\'dateline\', TIMENOW);\r\n $trollpm->save();\r\n }\r\n\r\n if ($trollalertforum) {\r\n $t_smilies = 1;\r\n $t_visible = 1;\r\n require_once(DIR . \'/includes/class_dm_threadpost.php\');\r\n $trollreport = new vB_DataManager_Thread_FirstPost($vbulletin, ERRTYPE_STANDARD);\r\n $trollreport->do_set(\'forumid\', $trollalertforum);\r\n $trollreport->do_set(\'userid\', $trollqueryuser[\'userid\']);\r\n $trollreport->do_set(\'username\', $trollqueryuser[\'username\']);\r\n $trollreport->do_set(\'title\', construct_phrase($vbphrase[troll_alertsubject], $vbulletin->userinfo[username]));\r\n $trollreport->do_set(\'pagetext\', construct_phrase($vbphrase[troll_alertmessage], $vbulletin->userinfo[username], $trolls, $blockstatus));\r\n $trollreport->do_set(\'allowsmilie\', $t_smilies);\r\n $trollreport->do_set(\'visible\', $t_visible);\r\n $sendtrollreport = $trollreport->save();\r\n \r\n require_once(DIR . \'/includes/functions_databuild.php\');\r\n build_forum_counters($trollalertforum);\r\n }\r\n }\r\n\r\n // Update database, so we won\'t get repeating in the forum and PM\'s\r\n $vbulletin->db->query_write(\"UPDATE user_troll SET alert = \" . TIMENOW . \" WHERE userid = \'\" . $vbulletin->userinfo[userid] . \"\' AND deleted = 0 ORDER by alert DESC LIMIT 1\");\r\n\r\n }\r\n/**** ALERT SECTION FINISH ****/\r\n\r\n\r\n/**** BLOCK TROLLS ON REQUEST BEGIN ****/\r\n// Check for special blocks start\r\n$trollblocknames = explode(\"\\n\", preg_replace(\"[\\r]\", \"\", strtolower($vbulletin->options[\'trollblockuser\'])));\r\n$trollexcludenames = explode(\"\\n\", preg_replace(\"[\\r]\", \"\", strtolower($vbulletin->options[\'trollexcludeuser\'])));\r\n\r\n foreach ($trollexcludenames as $texclude => $excludenames) {$exclude[strtolower($excludenames)] = strtolower($excludenames);}\r\n\r\n// Want to block banned users from forum? Array it here...\r\nif ($trollautoblockBans == 1) {\r\n $trollbans = $vbulletin->db->query(\"SELECT * from \" . TABLE_PREFIX . \"userban\");\r\n\r\n while ($trollban = $vbulletin->db->fetch_array($trollbans)) {\r\n $realuserBAN = fetch_userinfo($trollban[userid]);\r\n if ($trollautoblockBans == 1) {\r\n // Force ban if any matches, but only if user is not admin...\r\n if (strtolower($trollnicksUID[$trollban[userid]]) == strtolower($trollban[userid]) AND $istrolladmin != 1) {\r\n $trollbanreason = $trollban[\'reason\'];\r\n if ($trollban[\'liftdate\']) {\r\n $trollbandate = vbdate($vbulletin->options[\'dateformat\'] . \', \' . $vbulletin->options[\'timeformat\'], $trollban[\'liftdate\']);\r\n } else {\r\n $trollbandate = $vbphrase[\'never\'];\r\n }\r\n $forcetrollban = 1;\r\n }\r\n if (strtolower($trollnicksNAME[$realuserBAN[username]]) == strtolower($realuserBAN[username]) AND $istrolladmin != 1) {\r\n $trollbanreason = $trollban[\'reason\'];\r\n if ($trollban[\'liftdate\']) {\r\n $trollbandate = vbdate($vbulletin->options[\'dateformat\'] . \', \' . $vbulletin->options[\'timeformat\'], $trollban[\'liftdate\']);\r\n } else {\r\n $trollbandate = $vbphrase[\'never\'];\r\n }\r\n $forcetrollban = 1;\r\n }\r\n }\r\n\r\n }\r\n if (!$trollbanreason) {$vbphrase[\'none\'];}\r\n}\r\n// End banblock array\r\n\r\nforeach ($trollblocknames as $trollers) {\r\n $counttrollblock++;\r\n if ($trollers > 0 && $vbulletin->userinfo[\'userid\'] == $trollers) {$dotrollblock = 1;}\r\n if ($trollers < 1 && strtolower($vbulletin->userinfo[\'username\']) == strtolower($trollers)) {$dotrollblock = 1;}\r\n\r\n // Linkmatching - Block the current logged in user if there\'s a match with the userlist in options.\r\n // This includes IP from v2.0.2 and up\r\n if (strtolower($trollers) == strtolower($trollnicksUID[$trollers])) {$dotrollblock = 1;}\r\n if (strtolower($trollers) == strtolower($trollnicksNAME[$trollers])) {$dotrollblock = 1;}\r\n if (strtolower($trollers) == strtolower($trollnicksIP[$trollers])) {$dotrollblock = 1;}\r\n}\r\n\r\n// If there is a count in the userlist, the blocklist is active. Of there\'s matches on the current\r\n// logged in userid/username, check how many userlinks we find. Then block if everything is ok\r\nif ($counttrollblock > 0 AND $dotrollblock == 1 AND $linked >= $trollblockusertrig) {\r\n $trollblock = $trollblockusertrig;\r\n }\r\n// Check for special blocks end\r\n\r\nif (strtolower($trollusername) == strtolower($exclude[$trollusername]) OR $vbulletin->userinfo[userid] == $exclude[$trolluserid]) {\r\n $forcetrollban = 0;\r\n $linked = 0;\r\n }\r\n\r\n/** BLOCKING AND BANNING BEGIN **/\r\n// Protect admins from being blocked\r\nif ($trollautoblockBans == 1 AND $forcetrollban == 1 AND $istrolladmin != 1 AND THIS_SCRIPT != \'iptracker.php\') {\r\n eval(\'$headinclude = \"\' . fetch_template(\'headinclude\') . \'\";\');\r\n eval(standard_error(fetch_error(\'nopermission_ban ned\', $trollbanreason, $trollbandate)));\r\n }\r\n\r\nif ($linked >= $trollblock AND $trollblock > 0 AND $istrolladmin != 1 AND THIS_SCRIPT != \'iptracker.php\') {\r\n $vbulletin->userinfo[\'badlocation\'] =1;\r\n $errormessage = construct_phrase($vbphrase[\'trollerror_toomanynicks\'], $linked);\r\n eval(\'$headinclude = \"\' . fetch_template(\'headinclude\') . \'\";\');\r\n eval(\'$header = \"\' . fetch_template(\'header\') . \'\";\');\r\n eval(\'$footer = \"\' . fetch_template(\'footer\') . \'\";\');\r\n eval(\'print_output(\"\' . fetch_template(\'STANDARD_ERROR\') . \'\");\');\r\n}\r\n/** BLOCKING AND BANNING FINISH **/\r\n\r\n\r\n/**** BLOCK TROLLS ON REQUEST FINISH ****/\r\n\r\n\r\n\r\n/******** CONTINUE IF THE USER ISN\'T BLOCKED ********/\r\n\r\n\r\n\r\n/**** RBL MONITORING BEGIN ****/\r\n// Is the rbl monitor installed?\r\nif ($rblInstalled) {\r\n // Are we allowed to look for proxies?\r\n if ($trollignoreopm == 1 OR $trollwarnopm == 1) {\r\n // Just return the value returned from the monitor\r\n $trollIsOPM = rbl_livecheck(1, $trollremote);\r\n }\r\n } else {\r\n // If nothing is correct, just say 0\r\n $trollIsOPM = 0;\r\n }\r\n/**** RBL MONITORING FINISH ****/\r\n\r\n\r\n\r\n\r\n\r\n/**** FQDN RESOLVE BEGIN ****/\r\n if ($trollFQDN AND $trolluseFQDN == 1) {\r\n // First, grab the names and split up with userid\r\n $trollFQnames = explode(\"\\n\", preg_replace(\"[\\r]\", \"\", $trollFQDN));\r\n foreach ($trollFQnames as $t_FQ => $trollresolve) {\r\n $trollrescache = $vbulletin->db->query(\"SELECT * from \" . TABLE_PREFIX . \"user_trollresolver WHERE host = \'$trollresolve\'\");\r\n $trollhost = array();\r\n $countcache = -1;\r\n // Can this host be found in the cache?\r\n while ($rescache = $vbulletin->db->fetch_array($trollrescache)) {$trollhost[$countcache++] = $rescache[ip];}\r\n\r\n // If nothing found in cache, start resolve the host\r\n $docache = 0;\r\n if ($countcache < 1) {\r\n $trollhost = gethostbynamel($trollresolve); // Array for full resolving\r\n $docache = 1; // Also remember the host as register-in-cache\r\n }\r\n\r\n // Now start looking up all resolved ips (yes, we support multiple ips under one FQDN)\r\n foreach ($trollhost as $trollip) {\r\n // If we have a match, save it with the userid where it belong\r\n if ($trollremote == $trollip) {$FQDNresolved[$trollresolve] = true;}\r\n // Don\'t forget to cache this host so we don\'t have to resolve it the next time\r\n if ($docache == 1) {\r\n $vbulletin->db->query_write(\"INSERT INTO \" . TABLE_PREFIX . \"user_trollresolver (host, ip, dateline) VALUES (\'$trollresolve\', \'$trollip\', \" . TIMENOW . \")\");\r\n }\r\n }\r\n\r\n }\r\n\r\n // Start fixing with the trolldb...\r\n foreach ($FQDNresolved as $FQDN => $Fvalue) {\r\n // IP ($trollremote), user ($Fvalue), FQDN ($FQDN)\r\n\r\n $realuserFQDN = fetch_userinfo($Fvalue);\r\n $findhost = $vbulletin->db->query_first(\"SELECT * FROM \" . TABLE_PREFIX . \"user_troll WHERE realip = \'$trollremote\' AND username = \'\" . $FQDN . \"\'\");\r\n\r\n // If this host isn\'t registered to the tracker, it\'s time to register (or update) it now, but do not interfere with the regular data (that\'s why we use the fqdn-field here!)\r\n\r\n if (!$findhost[idx]) {\r\n $vbulletin->db->query_write(\"INSERT INTO \" . TABLE_PREFIX . \"user_troll (userid, realip, forwarded_for, username, timestamp, http_via, date, time, opm, fqdn) VALUES (\'$trolluserid\', \'$trollremote\', \'$forwarded\', \'$FQDN\', \'$timestamp\' , \'$via\', \'$trolldate\', \'$trolltime\', \'$trollIsOPM\', \'1\')\");\r\n } else {\r\n $vbulletin->db->query_write(\"UPDATE \" . TABLE_PREFIX . \"user_troll SET timestamp = $timestamp, date = \'$trolldate\', time = \'$trolltime\', opm = \'$trollIsOPM\', imported = 0 WHERE idx = \'\" . $findhost[idx] . \"\' AND deleted = 0 AND fqdn = 1 LIMIT 1\"); }\r\n\r\n }\r\n }\r\n/**** FQDN RESOLVE FINISH ****/\r\n\r\n\r\n\r\n\r\n\r\n/**** STORAGE PREPARE BEGIN ****/\r\n// How to check the database when inserting new entries\r\nif ($followtroll == 1) \r\n {\r\n $trollquery = \"WHERE realip = \'$trollremote\' AND deleted = 0 AND fqdn = 0 ORDER BY timestamp DESC\";\r\n } else {\r\n $trollquery = \"WHERE userid = \'$trolluserid\' AND realip = \'$trollremote\' AND deleted = 0 AND fqdn = 0 ORDER BY timestamp DESC\";\r\n // Switch lookup type, by request\r\n if ($trolluseridlookup == 0) {\r\n $trollquery = \"WHERE username = \'\" . $trollusername . \"\' AND realip = \'$trollremote\' AND deleted = 0 AND fqdn = 0 ORDER BY timestamp DESC\";\r\n }\r\n }\r\n/**** STORAGE PREPARE FINISH ****/\r\n\r\n\r\n\r\n/**** STORAGE DATA COLLECTING BEGIN ****/\r\n$ftroll = $vbulletin->db->query_first(\"SELECT * from \" . TABLE_PREFIX . \"user_troll $trollquery LIMIT 1\");\r\n\r\n$usedtroll = $ftroll[\'realip\'];\r\n$trollid = $ftroll[\'idx\'];\r\n$trolluser = $ftroll[\'userid\'];\r\n\r\n$trollVIA = $ftroll[\'http_via\'];\r\n$trollFOR = $ftroll[\'forwarded_for\'];\r\n\r\nif ($forwarded != $trollFOR OR $via != $trollVIA) {$trollheadermismatch = 1;}\r\n\r\n// If there is any userid found in database, we should check the first nick used by looking up the host and the userlink data\r\nif ($trolluser > 0 AND $trollremote != \'\') {\r\n $firsttroll = $vbulletin->db->query_first(\"SELECT userid,realip,timestamp from \" . TABLE_PREFIX . \"user_troll WHERE userid > 0 AND realip = \'$trollremote\' AND deleted = 0 AND fqdn = 0 ORDER by timestamp DESC, userid ASC LIMIT 1\");\r\n $firsttrollid = $firsttroll[\'userid\'];\r\n\r\n $followlink = $vbulletin->db->query_first(\"SELECT userid,userlink from \" . TABLE_PREFIX . \"user_troll WHERE userid = \'$trolluserid\' AND userlink > 0 AND deleted = 0 AND fqdn = 0 ORDER by userlink ASC LIMIT 1\");\r\n\r\n // Did it? Then replace this id with the first found in db\r\n if ($followlink[\'userlink\'] != $firsttrollid) {$firsttrollid = $followlink[\'userlink\'];}\r\n\r\n // Save data about any user who possibly used this ip first\r\n if ($firsttrollid > 0) {\r\n $vbulletin->db->query_write(\"UPDATE \" . TABLE_PREFIX . \"user_troll SET userlink = \'$firsttrollid\' WHERE idx = \'$trollid\' AND deleted = 0 AND fqdn = 0 LIMIT 1\");\r\n }\r\n}\r\n/**** STORAGE DATA COLLECTING FINISH ****/\r\n\r\n\r\n\r\n/**** SESSION STORAGE BEGIN ****/\r\n// Force updating of the session-table on request (this is stupid!)\r\nif ($trollsession == 1 AND $trollremote != \'\') {\r\n\r\n // Lookup latest used username from specific IP\r\n $lasttroll = $vbulletin->db->query_first(\"SELECT * from \" . TABLE_PREFIX . \"user_troll WHERE userid > 0 AND realip = \'$trollremote\' AND deleted = 0 ORDER BY timestamp DESC LIMIT 1\");\r\n $trolluser = $lasttroll[\'userid\'];\r\n\r\n if ($trolluser) {\r\n $vbulletin->db->query_write(\"UPDATE \" . TABLE_PREFIX . \"session SET userid = \'$trolluser\', lastactivity = $timestamp WHERE host = \'$trollremote\'\");\r\n // If this is true, troller is already found and forced into sessions...\r\n $dosavetroll = 0;\r\n }\r\n\r\n}\r\n/**** SESSION STORAGE FINISH ****/\r\n\r\n\r\n// Do not register not logged in users on request\r\nif ($trollunreg == 0 AND $trolluserid < 1) {$dosavetroll = 0;}\r\n\r\n// Do not save RBL\'s on request\r\nif ($trollignoreopm == 1 AND $trollIsOPM == 1) {$dosavetroll = 0;}\r\n\r\n// Changes in headers?\r\nif ($trollheadermismatch == 1 AND $trolluniqueheaders == 1) {$dosavetroll = 1;}\r\n\r\n\r\n\r\n/**** TROLLDB STORAGE BEGIN ****/\r\nif ($dosavetroll == 1) {\r\n\r\n if (!$usedtroll) {\r\n // If the user wasn\'t found in the database, we will add it...\r\n $vbulletin->db->query_write(\"INSERT INTO \" . TABLE_PREFIX . \"user_troll (userid, realip, forwarded_for, username, timestamp, http_via, date, time, opm) VALUES (\'$trolluserid\', \'$trollremote\', \'$forwarded\', \'\" . $trollusername . \"\', $timestamp, \'$via\', \'$trolldate\', \'$trolltime\', \'$trollIsOPM\')\");\r\n } else {\r\n // Changes will make the database change selected entry to not imported\r\n // If the user was found in the database, we won\'t duplicate it - instead, we\'re updating the latest login\r\n $vbulletin->db->query_write(\"UPDATE \" . TABLE_PREFIX . \"user_troll SET timestamp = $timestamp, date = \'$trolldate\', username = \'\" . $trollusername . \"\', userid = \'$trolluserid\', time = \'$trolltime\', opm = \'$trollIsOPM\', imported = 0 WHERE idx = \'$trollid\' AND deleted = 0 AND fqdn = 0 LIMIT 1\");\r\n }\r\n}\r\n/**** TROLLDB STORAGE FINISH ****/\r\n\r\n\r\n\r\n} // End of enable check... Turns this plugin completely off or on...', 'trolltracker');

MySQL Error : Unknown column 'executionorder' in 'field list'
Error Number : 1054
Date : Tuesday, September 19th 2006 @ 05:42:28 PM

What now?

TMM-TT 09-19-2006 02:54 PM

Sorry. I exported the hack from vB 3.6 so "executionorder" is an unkown database-field for 3.5. I had the same problem when I forgot to remove that field. Fixed now ;)

Alfa1 09-19-2006 03:04 PM

Many thanks.

Can you please add a small explanation of the functions. I am confused with this:
When I enter a username, select resolve IP address, the tracker finds an amount of entries, but does not display them.


All times are GMT. The time now is 09:49 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.01332 seconds
  • Memory Usage 1,876KB
  • 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
  • (1)bbcode_code_printable
  • (10)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (4)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