You see, Cutenews has its own forums, CutePHP Forums, and on those forums I tried searching for some help. I found a topic that could help me. I've tried using the first method and followed all the instructions.
QUOTE
Hack Name: Spam protection with random bot word.
Description: people will have to fill in this word before the comment can be added to the database. This word is a generated String of letters and numbers. This hack is updated on 06/08/2008 to improve the effectivness. It should work now with more then 1 include code, though that's unconfirmed!.
Author: FUNimations
Extra credits: Ifa
1. open the file that has your CN include code ... important make back-up first.
add
At the top of that page. This must be the very first php code!!
If you get a warning/error about sessions on your site. This will be due to the fact you have another php script in there that also uses sessions.
Ask their support what to do. And tell them that session_start() allready happens before you use their script. This function is a php function and is not limited to a script, but can be used by all scripts in that page.
2. open shows.inc.php in inc folder
find
add under
find
and add under
find
add under
find
add above
Please ... before you save show.inc.php , make sure javascript dont have space like this
java script:history.go(-1)
find
add under
3. Go to the comments form template.
Put something along this piece of code goes inside the comments form template.
Description: people will have to fill in this word before the comment can be added to the database. This word is a generated String of letters and numbers. This hack is updated on 06/08/2008 to improve the effectivness. It should work now with more then 1 include code, though that's unconfirmed!.
Author: FUNimations
Extra credits: Ifa
1. open the file that has your CN include code ... important make back-up first.
add
CODE
<?php session_start(); ?>
At the top of that page. This must be the very first php code!!
If you get a warning/error about sessions on your site. This will be due to the fact you have another php script in there that also uses sessions.
Ask their support what to do. And tell them that session_start() allready happens before you use their script. This function is a php function and is not limited to a script, but can be used by all scripts in that page.
2. open shows.inc.php in inc folder
find
CODE
$mail = trim($mail);
add under
CODE
$test = trim($_POST[$_SESSION['spam']]);
find
CODE
<input type=\"hidden\" name=\"ucat\" value=\"$ucat\" />
and add under
CODE
<input type=\"hidden\" name=\"".$_SESSION['spam']."\" value=\"$test\" />
find
CODE
$mail = replace_comment("add", preg_replace("/\n/", "",$mail));
add under
CODE
$test = replace_comment("add", preg_replace("/\n/", "",$test));
find
CODE
if($name == " " or $name == ""){
add above
CODE
if($_SESSION[$_SESSION['spam']] == $test ) {$ok = TRUE;}
else
{ echo("<div style=\"text-align: center;color:white;background-color:darkred;\"> Your write too long!<br /> <a href=\"java script:history.go(-1)\"> go back </a> </div>");
$CN_HALT = TRUE;
break 1;
}
else
{ echo("<div style=\"text-align: center;color:white;background-color:darkred;\"> Your write too long!<br /> <a href=\"java script:history.go(-1)\"> go back </a> </div>");
$CN_HALT = TRUE;
break 1;
}
Please ... before you save show.inc.php , make sure javascript dont have space like this
java script:history.go(-1)
find
CODE
$template_form = str_replace("{smilies}", $smilies_form, $template_form);
add under
CODE
if( !isset($input_name) ){
function code($nc, $a='abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0') {
$l=strlen($a)-1; $r='';
while($nc-->0) $r.=$a{mt_rand(0,$l)};
return $r;
}
$input_name = code(10);
$_SESSION['spam'] = $input_name;
$code = code(5);
$_SESSION[$input_name] = $code;
}
$template_form = str_replace("{smilies}", $smilies_form, $template_form);
$template_form = str_replace("{bot-inputname}", $_SESSION['spam'] ,$template_form);
$template_form = str_replace("{bot-word}", $_SESSION[$_SESSION['spam']] ,$template_form);
function code($nc, $a='abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0') {
$l=strlen($a)-1; $r='';
while($nc-->0) $r.=$a{mt_rand(0,$l)};
return $r;
}
$input_name = code(10);
$_SESSION['spam'] = $input_name;
$code = code(5);
$_SESSION[$input_name] = $code;
}
$template_form = str_replace("{smilies}", $smilies_form, $template_form);
$template_form = str_replace("{bot-inputname}", $_SESSION['spam'] ,$template_form);
$template_form = str_replace("{bot-word}", $_SESSION[$_SESSION['spam']] ,$template_form);
3. Go to the comments form template.
Put something along this piece of code goes inside the comments form template.
CODE
<tr>
<td width="450" height="1">
<small>Type {bot-word} in the box:</small>
</td>
<td width="450" height="1"><small><input type="text" name="{bot-inputname}" tabindex="1"> (anti-spam)</small>
</td>
</tr>
<td width="450" height="1">
<small>Type {bot-word} in the box:</small>
</td>
<td width="450" height="1"><small><input type="text" name="{bot-inputname}" tabindex="1"> (anti-spam)</small>
</td>
</tr>
I did exactly what it said but it still didn't work. I'm not so sure about the first step but I added the <?php session_start(); ?> as the first line under my <body> tag. I haven't used the CAPCTCHA method yet but I just want to see if there is any way of doing like this, without a CAPTCHA. Any help would be greatly appreciated. Thanks.