Revision history for BadBehavior


Revision [23158]

Last edited on 2016-05-20 07:38:47 by NilsLindenberg [Replaces old-style internal links with new pipe-split links.]
Additions:
~-[[ThirdPartyIntegration | Experimental 3rd party software integration in wikka]]
~-[[Docs:ThirdPartyInfo | 3rdparty software officially bundled with wikka]]
Bad Behavior is a set of PHP scripts which prevents spambots from accessing your site by analyzing their actual HTTP requests and comparing them to profiles from known spambots. It goes far beyond User-Agent and Referer, however. Bad Behavior is available for several PHP-based software packages, and also can be integrated in seconds into any PHP script. (quote from the [[http://www.bad-behavior.ioerror.us/ | homepage]]).
~1. [[http://www.ioerror.us/software/bad-behavior/bad-behavior-download/ | download]] it
~1. [[http://www.bad-behavior.ioerror.us/download/ | download it]]
Deletions:
~-[[ThirdPartyIntegration Experimental 3rd party software integration in wikka]]
~-[[Docs:ThirdPartyInfo 3rdparty software officially bundled with wikka]]
Bad Behavior is a set of PHP scripts which prevents spambots from accessing your site by analyzing their actual HTTP requests and comparing them to profiles from known spambots. It goes far beyond User-Agent and Referer, however. Bad Behavior is available for several PHP-based software packages, and also can be integrated in seconds into any PHP script. (quote from the [[http://www.bad-behavior.ioerror.us/ homepage]]).
~1. [[http://www.ioerror.us/software/bad-behavior/bad-behavior-download/ download]] it
~1. [[http://www.bad-behavior.ioerror.us/download/ download it]]


Revision [19035]

Edited on 2008-01-28 00:13:52 by NilsLindenberg [Modified links pointing to docs server]
Additions:
~-[[Docs:ThirdPartyInfo 3rdparty software officially bundled with wikka]]
Deletions:
~-[[ThirdPartyInfo 3rdparty software officially bundled with wikka]]


Revision [16062]

Edited on 2007-02-04 14:47:43 by NilsLindenberg [Modified links pointing to docs server]
Additions:
- I should take a look at the version from Mike (see comments below)


Revision [16061]

Edited on 2007-02-04 14:43:08 by NilsLindenberg [new homepage, start for the integration of 2.0.x series]
Additions:
Bad Behavior is a set of PHP scripts which prevents spambots from accessing your site by analyzing their actual HTTP requests and comparing them to profiles from known spambots. It goes far beyond User-Agent and Referer, however. Bad Behavior is available for several PHP-based software packages, and also can be integrated in seconds into any PHP script. (quote from the [[http://www.bad-behavior.ioerror.us/ homepage]]).
=== Bad-Behavior 1.2.x series ===
''these instructions are for version 1.2.1 but should work for the whole 1.2.x series''
=== Bad Behavior 2.0.x series ===
// note: this is a it's-working-for-me, i.e. an alpha version.//
~1. [[http://www.bad-behavior.ioerror.us/download/ download it]]
~2. extract the zip-file and upload the content of the **subfolder** bad-behavior (i.e from admin.inc.php to whitelist.inc.php) to **3rdparty/plugins/bad-behavior**
~3. Add the following file as ##bad-behavior-wikkawiki.php## to the same folder:
%%(php;1)
* Contains the functions and config entries needed by Bad Behavior 2.
*
* Only this file should be used as an entry point from within wikkawiki.
* It is based on the generic file of Bad Behavior 2.x and has been adjusted for the use with wikkawiki.
*
* @package 3rdparty
* @subpackage Bad Behavior
* @version $Id$
* @filesource
*
* @author {@link http://www.bad-behavior.ioerror.us/ Michael Hampton} (generic entry file)
* @author {@link http://www.wikkawiki.org/NilsLindenberg Nils Lindenberg} (adjusted for wikkawiki)
* @license http://www.gnu.org/copyleft/gpl.html GNU General Public License
Copyright (C) 2005-2006 Michael Hampton
As a special exemption, you may link this program with any of the
programs listed below, regardless of the license terms of those
programs, and distribute the resulting program, without including the
source code for such programs: ExpressionEngine
Please report any problems to badbots AT ioerror DOT us
* Hold the directory of Bad Behavior 2 to protect it from being called directly.
define('BB2_CWD', dirname(__FILE__).DIRECTORY_SEPARATOR);
* Hold Bad Behavior Settings.
$bb2_settings_defaults = array(
'log_table' => $wakka->GetConfigValue('table_prefix').'bad_behavior',
'display_stats' => true,
'strict' => false,
'verbose' => false
);
// Bad Behavior callback functions.
* Return current time.
*
* @return string current time in MySQL format.
function bb2_db_date() {
* Return affected rows from most recent query.
*
* not used.
*
* @return int number of affected rows from most recent query.
* @todo write function.
*/
function bb2_db_affected_rows() {
//return $this->getAffectedRows();
print "bb2_db_affected_rows";
* Escape a string for database usage.
*
* @param string $string mandatory: string to be escaped.
* @return string MySQL escaped string.
function bb2_db_escape($string) {
return mysql_real_escape_string($string);
* Return the number of rows in a particular query.
*
* @return int number of row
*/
function bb2_db_num_rows($result) {
if ($result !== FALSE)
return count($result);
return 0;
* Run a query and return the results, if any.
*
* Bad Behavior will use the return value here in other callbacks.
* Due to Wakka::Query() stopping in case of an error this will never return false.
*
* @uses Wakka::Query()
* @param string $query mandatory: MySQL-Query to be executed.
* @return mixed result of the query.
function bb2_db_query($query) {
return $wakka->Query($query);
* Return all rows in a particular query.
*
* Should contain an array of all rows generated by calling mysql_fetch_assoc()
* or equivalent and appending the result of each call to an array.
*
* Not used.
function bb2_db_rows($result) {
while ($row = mysql_fetch_assoc($result)) $return[] = $row;

mysql_free_result($result);
return $return;
* Return emergency contact email address.
*
* @see wikka.config.php
* @uses Config::$admin_email
* @uses Wakka::GetConfigValue()
* @return string email adress of wikka admin
*/
function bb2_email() {
return $wakka->GetConfigValue('admin_email');
* Retrieve Bad Behavior 2 settings.
*
* Hardcoded in this file (see above)
* @return array settings for bb2
function bb2_read_settings() {
global $bb2_settings_defaults;
return $bb2_settings_defaults;
* Write settings to database.
*
* Not used.
* @return boolean FALSE
*/
function bb2_write_settings($settings) {
return false;
* Install Bad Behavior 2.
*
* Not used, we'll use wikka-installer instead.
*
* @return boolean FALSE
function bb2_install() {
return false;
* Insert the javascript for the Screener into a html file.
*
* This is optional we'll fall back to cookies if you don't use it.
function bb2_insert_head() {
global $bb2_javascript;
echo $bb2_javascript;
* Display stats (enabled by default).
*
* Used by {{badbehavior}} action.
*/
function bb2_insert_stats($force = false) {
$settings = bb2_read_settings();
if ($force || $settings['display_stats']) {
$blocked = bb2_db_query("SELECT COUNT(*) FROM " . $settings['log_table'] . " WHERE `key` NOT LIKE '00000000'");
if ($blocked !== FALSE) {
return(sprintf('<p><a href="http://www.homelandstupidity.us/software/bad-behavior/">%1$s</a> %2$s <strong>%3$s</strong> %4$s</p>', __('Bad Behavior'), __('has blocked'), $blocked[0]["COUNT(*)"], __('access attempts in the last 7 days.')));
}
else return('Nobody blocked yet.');
else return('The display of Bad Behavior stats has been turned off.');
* Return the top-level relative path of wherever we are (for cookies).
*/
function bb2_relative_path() {
return $wakka->GetConfigValue("base_url");
// Calls inward to Bad Behavor itself.
require_once(BB2_CWD . "version.inc.php");
require_once(BB2_CWD . "core.inc.php");
//bb2_install();
bb2_start(bb2_read_settings());
CREATE TABLE IF NOT EXISTS wikka_bad_behavior (
`id` INT(11) NOT NULL auto_increment,
`ip` TEXT NOT NULL,
`date` DATETIME NOT NULL default '0000-00-00 00:00:00',
`request_method` TEXT NOT NULL,
`request_uri` TEXT NOT NULL,
`server_protocol` TEXT NOT NULL,
`http_headers` TEXT NOT NULL,
`user_agent` TEXT NOT NULL,
`request_entity` TEXT NOT NULL,
`key` TEXT NOT NULL,
INDEX (`ip`(15)),
INDEX (`user_agent`(10)),
PRIMARY KEY (`id`) );
~ 5. edit ##actions/header.php## and add the following line:
%%(php;29)
<?php bb2_insert_head(); #BB2 ?>
%%
behind
%%(php;28)
<base href="<?php echo $site_base ?>" />
~ 6. edit ##wikka.php## and add the following line:
%%(php;221)
require_once('3rdparty/plugins/bad-behavior/bad-behavior-wikkawiki.php'); #BB2
before the
%%(php;222)
/**
* Run the engine.
== Issues ==
- no config-options yet.
- it probably breaks with mode-rewrite=off
- not all of the functions are finished (they require some changes which would be better located in the core), but none of these is used (at least in 2.0.10)
Deletions:
Bad Behavior is a set of PHP scripts which prevents spambots from accessing your site by analyzing their actual HTTP requests and comparing them to profiles from known spambots. It goes far beyond User-Agent and Referer, however. Bad Behavior is available for several PHP-based software packages, and also can be integrated in seconds into any PHP script. (quote from the [[http://www.ioerror.us/software/bad-behavior/ homepage]]).
''these instructions are for version 1.2.1''


Revision [10893]

Edited on 2005-08-30 14:29:09 by NilsLindenberg [version 1.2.1]
Additions:
''these instructions are for version 1.2.1''
~4. install the mysql-table (replace wikka_ in the first line with your table-prefix - must be the same as in the wikka.config!) :
CREATE TABLE IF NOT EXISTS wikka_bad_behavior(
`id` int( 11 ) NOT NULL AUTO_INCREMENT ,
`ip` text NOT NULL ,
`date` datetime NOT NULL default '0000-00-00 00:00:00',
`request_method` text NOT NULL ,
`http_host` text,
`request_uri` text NOT NULL ,
`server_protocol` text NOT NULL ,
`http_referer` text,
`http_user_agent` text,
`http_headers` text NOT NULL ,
`request_entity` text NOT NULL ,
`denied_reason` text NOT NULL ,
`http_response` int( 3 ) NOT NULL ,
PRIMARY KEY ( `id` )
)
Deletions:
''these instructions are for version 1.2. For upgrading see the notes at the end.''
~4. change the ##bad-behavior-database.php##:
%%(php;35)
// Determine if we can skip all this
// If this exists, table structure is presumed up to date
$query = "DESCRIBE `" . WP_BB_LOG . "` `denied_reason`;";
if (wp_bb_db_query($query) != 0) return;
to
%%(php;35)
/* Determine if we can skip all this
If this exists, table structure is presumed up to date
$query = "DESCRIBE `" . WP_BB_LOG . "` `denied_reason`;";
if (wp_bb_db_query($query) != 0) return; */
~7. undo step 4!


Revision [10797]

Edited on 2005-08-22 19:48:39 by NilsLindenberg [version 1.2]
Additions:
''these instructions are for version 1.2. For upgrading see the notes at the end.''
~1. [[http://www.ioerror.us/software/bad-behavior/bad-behavior-download/ download]] it
~2. unzip the file, go into the folder and make the following changes:
~3. add ##bad-behavior-wikkawiki.php## to the folder, with the following content:
~4. change the ##bad-behavior-database.php##:
%%(php;35)
// Determine if we can skip all this
// If this exists, table structure is presumed up to date
if (wp_bb_db_query($query) != 0) return;
to
%%(php;35)
/* Determine if we can skip all this
If this exists, table structure is presumed up to date
if (wp_bb_db_query($query) != 0) return; */
~5. upload the whole folder to ##3rdparty/plugins/bad-behavior/##
~6. add the following line to ##wikka.php##
~7. undo step 4!
Deletions:
''these instructions are for version 1.2-RC3. For upgrading see the notes at the end.''
1) [[http://www.ioerror.us/software/bad-behavior/bad-behavior-download/ download]] it
1) unzip the file, go into the folder and make the following changes:
1) add ##bad-behavior-wikkawiki.php## to the folder, with the following content:
upload the whole folder to ##3rdparty/plugins/bad-behavior/##
===Calling Bad-behavior===
add the following line to ##wikka.php##
====Upgrading====
The table upgrade in 1.2.rc3 has an error so you have to swap the following:
%%(php;39)
// Upgrades from 1.1
if (wp_bb_db_query($query) == 0) {
$query = "ALTER TABLE `" . WP_BB_LOG . "` ADD `denied_reason` TEXT AFTER `request_entity`;";
if (wp_bb_db_query($query) === FALSE) {
$wp_bb_db_failure = TRUE;
}
// Upgrades from 1.0
$query = "DESCRIBE `" . WP_BB_LOG . "` `request_entity`;";
if (wp_bb_db_query($query) == 0) {
$query = "ALTER TABLE `" . WP_BB_LOG . "` ADD `request_entity` TEXT AFTER `http_headers`;";
if (wp_bb_db_query($query) === FALSE) {
$wp_bb_db_failure = TRUE;
}
%%(php;39)
// Upgrades from 1.0
$query = "DESCRIBE `" . WP_BB_LOG . "` `request_entity`;";
if (wp_bb_db_query($query) == 0) {
$query = "ALTER TABLE `" . WP_BB_LOG . "` ADD `request_entity` TEXT AFTER `http_headers`;";
if (wp_bb_db_query($query) === FALSE) {
$wp_bb_db_failure = TRUE;
}
// Upgrades from 1.1
if (wp_bb_db_query($query) == 0) {
$query = "ALTER TABLE `" . WP_BB_LOG . "` ADD `denied_reason` TEXT AFTER `request_entity`;";
if (wp_bb_db_query($query) === FALSE) {
$wp_bb_db_failure = TRUE;
}


Revision [10796]

Edited on 2005-08-22 19:33:48 by NilsLindenberg [small code-change (tag-correction)]
Additions:
<?php
Deletions:
?php


Revision [10795]

Edited on 2005-08-22 19:32:09 by NilsLindenberg [line added]
Additions:
=> right before the %%(php;1171)// go !%%---
Deletions:
=> right before the %%(php)// go ! %%---


Revision [10778]

Edited on 2005-08-19 15:15:21 by UserFolderol [line added]

No Differences

Revision [10657]

Edited on 2005-08-12 15:55:04 by NilsLindenberg [note on upgrading]
Additions:
''these instructions are for version 1.2-RC3. For upgrading see the notes at the end.''
====Upgrading====
The table upgrade in 1.2.rc3 has an error so you have to swap the following:
%%(php;39)
// Upgrades from 1.1
$query = "DESCRIBE `" . WP_BB_LOG . "` `denied_reason`;";
if (wp_bb_db_query($query) == 0) {
$query = "ALTER TABLE `" . WP_BB_LOG . "` ADD `denied_reason` TEXT AFTER `request_entity`;";
if (wp_bb_db_query($query) === FALSE) {
$wp_bb_db_failure = TRUE;
}
// Upgrades from 1.0
$query = "DESCRIBE `" . WP_BB_LOG . "` `request_entity`;";
if (wp_bb_db_query($query) == 0) {
$query = "ALTER TABLE `" . WP_BB_LOG . "` ADD `request_entity` TEXT AFTER `http_headers`;";
if (wp_bb_db_query($query) === FALSE) {
$wp_bb_db_failure = TRUE;
}
%%(php;39)
// Upgrades from 1.0
$query = "DESCRIBE `" . WP_BB_LOG . "` `request_entity`;";
if (wp_bb_db_query($query) == 0) {
$query = "ALTER TABLE `" . WP_BB_LOG . "` ADD `request_entity` TEXT AFTER `http_headers`;";
if (wp_bb_db_query($query) === FALSE) {
$wp_bb_db_failure = TRUE;
}
// Upgrades from 1.1
$query = "DESCRIBE `" . WP_BB_LOG . "` `denied_reason`;";
if (wp_bb_db_query($query) == 0) {
$query = "ALTER TABLE `" . WP_BB_LOG . "` ADD `denied_reason` TEXT AFTER `request_entity`;";
if (wp_bb_db_query($query) === FALSE) {
$wp_bb_db_failure = TRUE;
}
Deletions:
''these instructions are for version 1.2-RC3''


Revision [10656]

Edited on 2005-08-12 15:44:00 by NilsLindenberg [bad-behavior-wikkawiki.php rewritten]
Additions:
''these instructions are for version 1.2-RC3''
?php
* @author: {@link http://www.ioerror.us/software/bad-behavior/ Michael Hampton} (generic entry file)
* @author: {Stefan Lindenberg} (simplification of the code)
* @version: 1.2
else $wp_bb_logging = TRUE;
if ($result === TRUE || $result === FALSE) $returnValue = $result;
else {
$data = mysql_fetch_row($result);
$query_parts = explode(" ",$query);
$mysql_statement = strtolower($query_parts[0]);
switch ($mysql_statement) {
case "insert":
case "delete":
case "update":
$returnValue = mysql_num_rows($result);
break;
case "select":
$returnValue = mysql_affected_rows();
break;
default:
if($data === FALSE) $returnValue = 0;
else $returnValue = 1;
}
mysql_free_result($result);
}
return $returnValue;
Deletions:
''these instructions are for version 1.1.4''
<?php




* @author: {@link http://www.ioerror.us/software/bad-behavior/ Michael Hampton} (generic entry file)
* @version: 1.0

else $wp_bb_logging = FALSE;

// run the query
if ($result === TRUE) return 1;

$data = mysql_fetch_row($result);
mysql_free_result($result);
//get the number of affected rows
$query_parts = explode(" ",$query);
$query_statement = strtolower($query_parts[0]);
switch ($query_statement) {
case "describe":
if ($data === FALSE) return 0;
else return 1;
case "insert":
case "delete":
case "update":
$rows_affected = mysql_num_rows($result);
break;
case "select":
$rows_affected = mysql_rows_affected($result);
break;
}
return $rows_affected;


Revision [10266]

Edited on 2005-07-30 16:47:19 by NilsLindenberg [removed unnnecessary php-tag]

No Differences

Revision [9982]

Edited on 2005-07-15 10:41:13 by DarTar [adding category]
Additions:
CategoryDevelopment3rdParty CategoryDevelopmentAntiSpam
Deletions:
CategoryDevelopment3rdParty


Revision [9979]

Edited on 2005-07-15 10:00:45 by NilsLindenberg [small update]
Additions:
**bad-behavior**:
- 0: don't run bad-behavior
- 1: run bad-behavior
**bad-behavior-logging**
- 0: don't log anything
- 1: log failed request
- 2: log all requests
Deletions:
var_dump($wakka->config['bad-behavior-logging']);


Revision [9978]

Edited on 2005-07-15 09:57:07 by NilsLindenberg [update]
Additions:
/**
* Entry point for using bad behavior with wikkawiki.
*
* @author: {@link http://www.ioerror.us/software/bad-behavior/ Michael Hampton} (generic entry file)
* @author: {@link http://wikka.jsnx.com/NilsLindenberg Nils Lindenberg} (rewritten for wikka)
*
* @version: 1.0
*/

//***Configuration***
var_dump($wakka->config['bad-behavior-logging']);
if ($wakka->config['bad-behavior-logging'] == 1) $wp_bb_logging = TRUE;
else $wp_bb_logging = FALSE;

if ($wakka->config['bad-behavior-logging'] == 2) $wp_bb_verbose_logging = TRUE;
else $wp_bb_verbose_logging = FALSE;
//***Callbacks***
// run the query
$query_parts = explode(" ",$query);
switch ($query_statement) {
%%
upload the whole folder to ##3rdparty/plugins/bad-behavior/##
===Calling Bad-behavior===
add the following line to ##wikka.php##
%%(php)
//load 'bad-behavior'
if ($wakka->config['bad-behavior'] == 1) require_once("3rdparty/plugins/bad-behavior/bad-behavior-wikkawiki.php");
%%
=> right before the %%(php)// go ! %%---
===Configuration===
add %%(php)
'bad-behavior' => '1',
'bad-behavior-logging' => '1',
%%
to your ##wikka.config.php##
Deletions:
// This file is the entry point for Bad Behavior.
// See below to customize it for your particular CMS or PHP application.
// Preferably by the time this file is loaded, everything in your app will
// be initialized, but no output sent to the browser. If output has been
// sent, Bad Behavior will fail.
###############################################################################
###############################################################################
// Configuration
// Nothing will be written to a DB unless you implement DB queries below
$wp_bb_logging = TRUE;
$wp_bb_verbose_logging = FALSE;
// You can customize the table name if necessary.
###############################################################################
# DO NOT EDIT BELOW THIS LINE
###############################################################################
// Callbacks
// generic code; you should reimplement these if you want logging and
// database functions
$query_parts = explode(" ",$query);
switch ($query_statement) {
%%---
1) upload the whole folder to ##3rdparty/plugins/bad-behavior/##---
1) if you want to log requests, you have to change one or both of the config-entries in the file above to 'TRUE'.
1) add the following line to ##wikka.php## %%(php//load 'bad-behavior'
if ($wakka->config['bad-behavior']) require_once("3rdparty/plugins/bad-behavior/bad-behavior-wikkawiki.php");%%--- => right before the %%(php)// go ! %%---
1) add %%(php) 'bad-behavior' => '1',%%--- to your ##wikka.config.php##
1)
====To-do====
- move config for logging into wikka.config.php


Revision [9969]

Edited on 2005-07-14 20:10:27 by NilsLindenberg [ugrade-problem solved]
Additions:
''these instructions are for version 1.1.4''
%%(php;1)
<?php
$wp_bb_logging = TRUE;
$result = $wakka->Query($query);
if ($result === TRUE) return 1;
$data = mysql_fetch_row($result);
mysql_free_result($result);
//get the number of affected rows
$query_parts = explode(" ",$query);
$query_statement = strtolower($query_parts[0]);
switch ($query_statement) {
case "describe":
if ($data === FALSE) return 0;
else return 1;
case "insert":
case "delete":
case "update":
$rows_affected = mysql_num_rows($result);
break;
case "select":
$rows_affected = mysql_rows_affected($result);
break;
}
return $rows_affected;
?>
%%---
1) if you want to log requests, you have to change one or both of the config-entries in the file above to 'TRUE'.
- move config for logging into wikka.config.php
Deletions:
''these instructions are for version 1.1.2''
%%(php;1)<?php
$wp_bb_logging = FALSE;
return $wakka->Query($query);
?>%%---
1) if you want to log requests, you have to add 'request_entity' (text, not null, after 'http_headers'-field) in your table. And you have to change one or both of the config-entries in the file above to 'TRUE'.
- fix the wp_bb_db_query
- testing on a page who is interesting for spammers :)
~~&Use a browser or (software) proxy that lets you define the user-agent string, set it to a "forbiden" spambot, and use that to load a page on the site; BadBehavior docs somewhere mention using lynx (just a command-line switch). Of course this will only check if the module is actually installed and working - not all possible behaviors it may be capable of stopping. --JavaWoman
===Problems===
problem with wp_bb_db_query //description will follow//.


Revision [9926]

Edited on 2005-07-10 10:30:09 by DarTar [adding see also box]
Additions:
>>**See also**
~-[[ThirdPartyIntegration Experimental 3rd party software integration in wikka]]
~-[[ThirdPartyInfo 3rdparty software officially bundled with wikka]]
>>::c::


Revision [9694]

Edited on 2005-06-29 10:43:28 by NilsLindenberg [instructions for version 1.1.2]
Additions:
''these instructions are for version 1.1.2''
$wp_bb_logging = FALSE;
// The database table name to use.
// You can customize the table name if necessary.
define('WP_BB_LOG', $wakka->config['table_prefix'].'bad_behavior_log');
1) upload the whole folder to ##3rdparty/plugins/bad-behavior/##---
1) if you want to log requests, you have to add 'request_entity' (text, not null, after 'http_headers'-field) in your table. And you have to change one or both of the config-entries in the file above to 'TRUE'.
1)
- fix the wp_bb_db_query
problem with wp_bb_db_query //description will follow//.
Deletions:
$wp_bb_logging = TRUE;
1)//(optional) to have the log in a database with the same prefix as your wikka:// change in ##bad-behavior-database.php## and in ##bad-behavior-core.php## the variable $wp_bb_log to %%(php)$wp_bb_log = $wakka->config['table_prefix']."bb_log";%%---
1) upload the whole folder to ##3rdparty/plugins/bad-behavior/##---
- ++make it optional, i.e. having a config-option to turn it off++
- ++using wikka-variables for table, admin-email instead of handcoding++
The newer versions ( >= 1.1) will cause an error, if you use the log-table. There are two problems:
- hardecoded table-name in bad-behavior-database.php
- the function in the file above works not as i expected
//workaround will follow//


Revision [9238]

Edited on 2005-06-15 18:14:38 by NilsLindenberg [problem with new(er) version]
Additions:
===Problems===
The newer versions ( >= 1.1) will cause an error, if you use the log-table. There are two problems:
- hardecoded table-name in bad-behavior-database.php
- the function in the file above works not as i expected
//workaround will follow//


Revision [8914]

Edited on 2005-06-07 12:36:28 by NilsLindenberg [renamed a file, fixed setting table_prefix]
Additions:
1) unzip the file, go into the folder and make the following changes:
1) add ##bad-behavior-wikkawiki.php## to the folder, with the following content:
1)//(optional) to have the log in a database with the same prefix as your wikka:// change in ##bad-behavior-database.php## and in ##bad-behavior-core.php## the variable $wp_bb_log to %%(php)$wp_bb_log = $wakka->config['table_prefix']."bb_log";%%---
1) upload the whole folder to ##3rdparty/plugins/bad-behavior/##---
if ($wakka->config['bad-behavior']) require_once("3rdparty/plugins/bad-behavior/bad-behavior-wikkawiki.php");%%--- => right before the %%(php)// go ! %%---
Deletions:
1) unzip the file and make the following changes:
1) replace ##bad-behavior-generic.php## in the directory with the following one:
1)change ##bad-behavior-database.php## the $wp_bb_log to %%(php)$wp_bb_log = $wakka->config['table_prefix']."bb_log";%%---
1) and upload the whole folder to ##3rdparty/plugins/bad-behavior/##---
if ($wakka->config['bad-behavior']) require_once("3rdparty/plugins/bad-behavior/bad-behavior-generic.php");%%--- => right before the %%(php)// go ! %%---


Revision [8895]

Edited on 2005-06-06 20:35:46 by JavaWoman [minor]
Additions:
~~&Use a browser or (software) proxy that lets you define the user-agent string, set it to a "forbiden" spambot, and use that to load a page on the site; BadBehavior docs somewhere mention using lynx (just a command-line switch). Of course this will only check if the module is actually installed and working - not all possible behaviors it may be capable of stopping. --JavaWoman
Deletions:
~~&Use a browser or (software) proxy that lets you define the user-agent string, set it to a "forbiden" spambot, and use that to load a page on the site; BadBehavior docs somewhere mention using lynx (just a command-line switch). Of course this will only check if the module is actually installed and workging not all possible behaviors it may be capable of stopping. --JavaWoman


Revision [8893]

Edited on 2005-06-06 19:33:08 by JavaWoman [comment re: testing]
Additions:
- testing on a page who is interesting for spammers :)
~~&Use a browser or (software) proxy that lets you define the user-agent string, set it to a "forbiden" spambot, and use that to load a page on the site; BadBehavior docs somewhere mention using lynx (just a command-line switch). Of course this will only check if the module is actually installed and workging not all possible behaviors it may be capable of stopping. --JavaWoman
Deletions:
- testing on a page who is interesting for spammers :)


Revision [8889]

Edited on 2005-06-06 19:09:47 by DarTar [removing useless indent]
Additions:
%%(php;1)<?php
Deletions:
~%%(php;1)<?php


Revision [8888]

Edited on 2005-06-06 19:03:28 by JavaWoman [trying new code display workaround]
Additions:





Revision [8887]

Edited on 2005-06-06 18:58:06 by JavaWoman [layout]
Additions:
?>%%---
1)change ##bad-behavior-database.php## the $wp_bb_log to %%(php)$wp_bb_log = $wakka->config['table_prefix']."bb_log";%%---
1) and upload the whole folder to ##3rdparty/plugins/bad-behavior/##---
if ($wakka->config['bad-behavior']) require_once("3rdparty/plugins/bad-behavior/bad-behavior-generic.php");%%--- => right before the %%(php)// go ! %%---
1) add %%(php) 'bad-behavior' => '1',%%--- to your ##wikka.config.php##
Deletions:
?>%%
1)change ##bad-behavior-database.php## the $wp_bb_log to %%(php)$wp_bb_log = $wakka->config['table_prefix']."bb_log";%%
1) and upload the whole folder to ##3rdparty/plugins/bad-behavior/##
if ($wakka->config['bad-behavior']) require_once("3rdparty/plugins/bad-behavior/bad-behavior-generic.php");%% => right before the %%(php)// go ! %%
1) add %%(php) 'bad-behavior' => '1',%% to your ##wikka.config.php##


Revision [8885]

Edited on 2005-06-06 17:02:38 by NilsLindenberg [little code change]
Additions:
if ($wakka->config['bad-behavior']) require_once("3rdparty/plugins/bad-behavior/bad-behavior-generic.php");%% => right before the %%(php)// go ! %%
1) add %%(php) 'bad-behavior' => '1',%% to your ##wikka.config.php##
Deletions:
if ($wakka->config['bad-behavior'] == 'on') require_once("3rdparty/plugins/bad-behavior/bad-behavior-generic.php");%% => right before the %%(php)// go ! %%
1) add %%(php) 'bad-behavior' => 'on',%% to your ##wikka.config.php##


Revision [8884]

Edited on 2005-06-06 16:51:51 by NilsLindenberg [making bb optional]
Additions:
1) replace ##bad-behavior-generic.php## in the directory with the following one:
~%%(php;1)<?php
/*
http://www.ioerror.us/software/bad-behavior/
Bad Behavior - detects and blocks unwanted Web accesses
Copyright (C) 2005 Michael Hampton
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
// This file is the entry point for Bad Behavior.
// See below to customize it for your particular CMS or PHP application.
// Preferably by the time this file is loaded, everything in your app will
// be initialized, but no output sent to the browser. If output has been
// sent, Bad Behavior will fail.
###############################################################################
###############################################################################
// Configuration
// Nothing will be written to a DB unless you implement DB queries below
// Log failed requests to the database.
$wp_bb_logging = TRUE;
// Log all requests to the database, not just failed requests.
$wp_bb_verbose_logging = FALSE;
// How long to keep the logs around (in days).
$wp_bb_logging_duration = 7;
// Email address to contact you in case of problems
// This will be shown to users on the error page, which means it will
// be exposed to spammers! Bad Behavior will munge it automatically; you
// should NOT munge it here!
$wp_bb_email = $wakka->config['admin_email'];
###############################################################################
# DO NOT EDIT BELOW THIS LINE
###############################################################################
define('WP_BB_CWD', dirname(__FILE__));
// Callbacks
// generic code; you should reimplement these if you want logging and
// database functions
// return a UTC date in the format preferred by your database
function wp_bb_date() {
return gmdate('Y-m-d H:i:s');
}
// run a SQL query and return # of rows affected, or FALSE if query failed
function wp_bb_db_query($query) {
return $wakka->Query($query);
}
// Load core functions and do initial checks
require_once(WP_BB_CWD . "/bad-behavior-core.php");
?>%%
1)change ##bad-behavior-database.php## the $wp_bb_log to %%(php)$wp_bb_log = $wakka->config['table_prefix']."bb_log";%%
1) and upload the whole folder to ##3rdparty/plugins/bad-behavior/##
1) add the following line to ##wikka.php## %%(php//load 'bad-behavior'
if ($wakka->config['bad-behavior'] == 'on') require_once("3rdparty/plugins/bad-behavior/bad-behavior-generic.php");%% => right before the %%(php)// go ! %%
1) add %%(php) 'bad-behavior' => 'on',%% to your ##wikka.config.php##
- ++make it optional, i.e. having a config-option to turn it off++
- ++using wikka-variables for table, admin-email instead of handcoding++
Deletions:
1) to ##bad-behavior-generic.php##:
~- change %%(php)$wp_bb_email = "xx@example.com";%% to the address of the wiki-adim
~- change the %%(php)function wp_bb_db_query($query)%% to %%(php)function wp_bb_db_query($query) {
return $wakka->Query($query);}%%
1)change ##bad-behavior-database.php## the $wp_bb_log to the table you want, like wikka_bb_blog for example.
1) and upload its content to ##3rdparty/plugins/bad-behavior/##
1) add the following line to ##wikka.php## %%(php)//load 'bad-behavior'
require_once("3rdparty/plugins/bad-behavior/bad-behavior-generic.php");%% => right before the %%(php)// go ! %%
- make it optional, i.e. having a config-option to turn it off
- using wikka-variables for table, admin-email instead of handcoding


Revision [8855]

Edited on 2005-06-06 10:37:43 by NilsLindenberg [added to-do]
Additions:
====To-do====
- make it optional, i.e. having a config-option to turn it off
- using wikka-variables for table, admin-email instead of handcoding
- testing on a page who is interesting for spammers :)


Revision [8854]

Edited on 2005-06-06 10:35:38 by NilsLindenberg [category added -comment]
Additions:
----
CategoryDevelopment3rdParty
Deletions:
====Comments====
~&It needs testing --NilsLindenberg


Revision [8852]

The oldest known version of this page was created on 2005-06-06 10:20:30 by NilsLindenberg [category added -comment]
Valid XHTML :: Valid CSS: :: Powered by WikkaWiki