$matches[2] Hidden input fields
$matches[2] This hack was based on an article posted here.
It's an attempt to fool spambots into thinking there is no spam protection and giving input fields random obscure names so there isn't a real pattern to input fields names. Visitors will notice nothing about the spam protection; No captchas or anything they need to fill out.
$matches[2] FUNimations
$matches[2]
For the most part we need editing in shows.inc.php so let's open this file
find
$user_query = cute_query_string($QUERY_STRING, array( "comm_start_from","start_from", "archive", "subaction", "id", "ucat"));
add above or below
CHANGE the word $matches[1] with some sort of securitycode you make up. And leave the quotes!
find
$name = trim($name);
$mail = trim($mail);
$id = (int) $id; // Yes it's stupid how I didn't thought about this :/
and replace with
$salt_name = md5($priv_salt.date('z'));
$salt = $_POST[$salt_name];
if(empty($salt))
{
$salt_name = md5($priv_salt.(date('z')-1));
$salt = $_POST[$salt_name];
}
$obsc_name = sha1('name'.$salt );
$obsc_mail = sha1( 'mail'.$salt );
$obsc_comment = sha1('comment'.$salt );
$true_name = sha1('tname'.$salt );
$true_mail = sha1('tmail'.$salt);
$true_comment = sha1('tcomment'.$salt);
$name = trim($_POST[$true_name]);
$mail = trim($_POST[$true_mail]);
$submit = trim($_POST['submit']);
$comments = trim($_POST[$true_comment]);
$id = (int) $id; // Yes it's stupid how I didn't thought about this :/
find
if( strlen($comments) > $config_comment_max_long and $config_comment_max_long != "" and $config_comment_max_long != "0"){
echo"<div style=\"text-align: center;\">Your comment is too long!</div>";
$CN_HALT = TRUE;
break 1;
}
and add below
if( $submit == "Add My Spam"){
echo"<div style=\"text-align: center;\">Spambot detected. Don't worry if you're not!</div>";
$CN_HALT = TRUE;
break 1;
}
//SPAMPROT
if(strlen(trim($_POST[$obsc_name])) >0 || strlen(trim($_POST[$obsc_mail])) >0 || strlen(trim($_POST[$obsc_comment])) >0)
{
echo"<div style=\"text-align: center;\">Spambot detected. Don't worry if you're not!</div>";
$CN_HALT = TRUE;
break 1;
}
find
echo"<div style=\"text-align: center;\">This name is owned by a registered user and you must enter password to use it
<form name=passwordForm id=passwordForm method=\"post\" action=\"\">
Password: <input type=\"password\" name=\"password\" />
<input type=\"hidden\" name=\"name\" value=\"$name\" />
<input type=\"hidden\" name=\"comments\" value=\"$comments\" />
<input type=\"hidden\" name=\"mail\" value=\"$mail\" />
<input type=\"hidden\" name=\"ip\" value=\"$ip\" />
<input type=\"hidden\" name=\"subaction\" value=\"addcomment\" />
<input type=\"hidden\" name=\"show\" value=\"$show\" />
<input type=\"hidden\" name=\"ucat\" value=\"$ucat\" />
$user_post_query
<input type=\"submit\" /> \n
<input type=\"checkbox\" name=\"CNrememberPass\" value=1 /> Remember password in cookie (md5 format)
</form>
</div>";
$CN_HALT = TRUE;
break 2;
}
replace with
//SPAMPROT
$salt_name = md5($priv_salt.date('z'));
$salt = $_POST[$salt_name];
if(empty($salt))
{
$salt_name = md5($priv_salt.(date('z')-1));
}
$obsc_name = sha1('name'.$salt );
$obsc_mail = sha1( 'mail'.$salt );
$obsc_comment = sha1('comment'.$salt );
$true_name = sha1('tname'.$salt );
$true_mail = sha1('tmail'.$salt);
$true_comment = sha1('tcomment'.$salt);
echo"<div style=\"text-align: center;\">This name is owned by a registered user and you must enter password to use it
<form name=passwordForm id=passwordForm method=\"post\" action=\"\">
Password: <input type=\"password\" name=\"password\" />
<input type=\"hidden\" name=\"$true_name\" value=\"$name\" />
<input type=\"hidden\" name=\"$true_comment\" value=\"$comments\" />
<input type=\"hidden\" name=\"$true_mail\" value=\"$mail\" />
<input type=\"hidden\" name=\"ip\" value=\"$ip\" />
<input type=\"hidden\" name=\"subaction\" value=\"addcomment\" />
<input type=\"hidden\" name=\"show\" value=\"$show\" />
<input type=\"hidden\" name=\"ucat\" value=\"$ucat\" />
<input type=\"hidden\" name=\"$salt_name\" value=\"$salt\" />
<input type=\"hidden\" name=\"$obsc_name\" value=\"$_POST[$obsc_name]\" />
<input type=\"hidden\" name=\"$obsc_mail\" value=\"$_POST[$obsc_mail]\" />
<input type=\"hidden\" name=\"$obsc_comment\" value=\"$_POST[$obsc_comment]\" />
$user_post_query
<input type=\"submit\" /> \n
<input type=\"checkbox\" name=\"CNrememberPass\" value=1 /> Remember password in cookie (md5 format)
</form>
</div>";
$CN_HALT = TRUE;
break 2;
}
find
$template_form = str_replace("{smilies}", $smilies_form, $template_form);
echo"<form $CN_remember_form method=\"post\" name=\"comment\" id=\"comment\" action=\"\">".$template_form."<div><input type=\"hidden\" name=\"subaction\" value=\"addcomment\" /><input type=\"hidden\" name=\"ucat\" value=\"$ucat\" /><input type=\"hidden\" name=\"show\" value=\"$show\" />$user_post_query</div></form>
\n $CN_remember_include";
replace with
//SPAMPROT
$salt = md5(time()+$_GET['id']+$_SERVER['REMOTE_ADDR']);
$salt_name = md5($priv_salt.date('z'));
$obsc_name = sha1('name'.$salt );
$obsc_mail = sha1( 'mail'.$salt );
$obsc_comment = sha1('comment'.$salt );
$true_name = sha1('tname'.$salt );
$true_mail = sha1('tmail'.$salt);
$true_comment = sha1('tcomment'.$salt);
$show = t.sha1( 'show'.$salt );//css classname my never start with a number
$hide = t.sha1( 'hide'.$salt );//css classname my never start with a number
$template_form = str_replace("{smilies}", $smilies_form, $template_form);
$template_form = str_replace("{spam-input-name}", $obsc_name, $template_form);
$template_form = str_replace("{spam-input-mail}", $obsc_mail, $template_form);
$template_form = str_replace("{spam-input-comment}", $obsc_comment, $template_form);
$template_form = str_replace("{real-input-name}", $true_name, $template_form);
$template_form = str_replace("{real-input-mail}", $true_mail, $template_form);
$template_form = str_replace("{real-input-comment}", $true_comment, $template_form);
$template_form = str_replace("{show}", $show, $template_form);
$template_form = str_replace("{hide}", $hide, $template_form);
echo"<style type=\"text/css\">.".$show."{display:inline;} .".$hide."{display:none;}</style><form $CN_remember_form method=\"post\" name=\"comment\" id=\"comment\" action=\"\"><input type=\"hidden\" name=\"".$salt_name."\" value=\"".$salt."\" />".$template_form."<div><input type=\"hidden\" name=\"subaction\" value=\"addcomment\" /><input type=\"hidden\" name=\"ucat\" value=\"$ucat\" /><input type=\"hidden\" name=\"show\" value=\"$show\" />$user_post_query</div></form>
\n $CN_remember_include";
//SPAMPROT
close shows.inc.php, save changes and upload the modified file.
Next change ALL your templates (the comments form part) like following.
First find (based on the default template)
<input type="submit" name="submit" value="Add My Comment">
and repalce it with
<span class="{hide}"><input type="submit" name="submit" value="Add My Spam"></span><span class="{show}"> <input type="submit" name="submit" value="Add My Comment"> </span>
Next we are going to replace all input fields:
<input type="text" name="name">
to
<span class="{show}"><input type="text" name="{real-input-name}"></span><span class="{hide}"><input type="text" name="{spam-input-name}"></span>
<input type="text" name="mail">
to
<span class="{show}"><input type="text" name="{real-input-mail}"></span><span class="{hide}"><input type="text" name="{spam-input-mail}"> </span>
<textarea cols="40" rows="6" id=commentsbox name="comments"></textarea>
to
<span class="{show}"><textarea cols="40" rows="6" id=commentsbox name="{real-input-comment}"></textarea></span><span class="{hide}"><textarea cols="40" rows="6" id=commentsbox name="{spam-input-comment}"></textarea></span>
And save the new template. That is all. Now it may be good for you to understand what the change in the template does. For each field we create a dummy field. The dummy fields will be invisible, so users won't notice them and won't be able to fill anything in. Bots however won't notice them as being invisible, so they will submit values for those fields. When CN detects the dummy fields as being filled in, it'll know it's a bot.
Now what you should know is that around every input field there is a span. You are free to swith the dummy field and the REAL field but don't forget to switch the span aswell so you don't accidently make the dummy fields visible and the rela fields invisible. It's a good idea to do some random ordering with these fields, so we don't have a standard
real dummy, real, dummy, real, dummy
order but you get something like
dummy real, dummy, dummy, real, real