'srgisdth',
'email' => 'dtbgfguk',
'url' => 'vjethy78',
);
/*
'comment' => 'dghw4jik'
*/
$commentinator_debug = false;
// change field names
function commentinator_change_names( $args )
{
global $commentinator_names;
global $commentinator_debug;
foreach( $commentinator_names as $name => $newname )
{
$args["$name"] = preg_replace( "/name=\"$name\"/",
"name=\"$newname\"", $args["$name"] );
$args["$name"] = preg_replace( "/id=\"$name\"/",
"id=\"$newname\"", $args["$name"] );
$args["$name"] = preg_replace( "/for=\"$name\"/",
"for=\"$newname\"", $args["$name"] );
}
return $args;
}
function commentinator_add_tar_and_honey( $postID )
{
global $commentinator_names;
global $commentinator_debug;
foreach( $commentinator_names as $name => $newname )
{
echo "";
}
echo "\n";
echo "\n";
}
function commentinator_check()
{
global $commentinator_names;
global $commentinator_debug;
foreach( $commentinator_names as $name => $newname )
{
// standard field must be empty
if( !empty( $_POST[$name] ) )
{
if( $commentinator_debug )
wp_die( "Comment rejected: $name nonempty." );
wp_die( "Comment rejected." );
}
// new field must be set
if( !isset( $_POST[$newname] ) )
{
if( $commentinator_debug )
wp_die( "Comment rejected: $newname is not set." );
wp_die( "Comment rejected." );
}
// fix things the way they should be for WP to continue
$_POST[$name] = $_POST[$newname];
unset( $_POST[$newname] );
}
// check the javascript variable
if( !isset( $_POST["gnarz"] ) )
{
if( $commentinator_debug )
wp_die( "Comment rejected: gnarz is not set." );
wp_die( "Comment rejected." );
}
if( $_POST["gnarz"] != "23" )
{
if( $commentinator_debug )
wp_die( "Comment rejected: gnarz is '".$_POST["gnarz"]."'." );
wp_die( "Comment rejected." );
}
}
/*
function check_honeypot($approved) {
if (!empty($_POST['more_comment'])) {
$approved = 'spam';
}
return $approved;
}
add_filter( 'pre_comment_approved', 'check_honeypot' );
*/
$commentinator_rand_chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz_0123456789";
function commentinator_rand_str()
{
global $commentinator_rand_chars;
$s = $commentinator_rand_chars[rand( 0, 52 )];
for( $i=0; $i<8; $i++ )
{
$s .= $commentinator_rand_chars[rand( 0, 62 )];
}
return $s;
}
function commentinator_sess_start()
{
global $commentinator_names;
$i = 0;
if( !session_id() )
{
session_start();
$names = array();
foreach( $commentinator_names as $name => $newname )
{
$names[$name] = commentinator_rand_str();
}
$_SESSION["commentinator_names"] = $names;
}
$commentinator_names = $_SESSION["commentinator_names"];
}
function commentinator_sess_end()
{
session_destroy();
}
add_action( 'init', 'commentinator_sess_start', 1 );
add_action( 'wp_logout', 'commentinator_sess_end' );
add_action( 'wp_login', 'commentinator_sess_end' );
add_filter( 'comment_form_default_fields', 'commentinator_change_names' );
add_action( 'comment_form', 'commentinator_add_tar_and_honey' );
add_action( 'pre_comment_on_post', 'commentinator_check' );