1
Mods & Plugins (Releases & Support) / [MOD] Anti-Spam v1.0 for Guestbook & Comments
« on: March 23, 2006, 09:17:12 PM »
[ Introduction ]
This Mod prevents spamming from Bots in your Guestbook and Commnts,
if you allowed guests to post there.
[ Features ]
This Mod works with an security code,
which must be validated when posting.
The security code is submitted using session system and javascript,
so users which have enabled javascript (which usually most users have),
doesn't notice anything.
users that disabled javascript have to enter the security code manually.
This is an great advantage compared to the captcha solution,
where every user have to enter this code, what is very uncomfortable in my opinion.
You can choose yourself if you use this mod only for guestbook/comments or for both.
[ Notes ]
At the moment the security code is on an very low level,
and not encrypted or anything else,
but it should anyway work.
If somebody gets anyway spam, he/she should contact me,
then i will upgrade this mod.
This mod works with 1.71 & 1.72
other versions are untested.
[ Changed Files ]
for Guestbook:
- guestbook.php
- templates/guestbook_form.html
for comments:
- details.php
- templates/comment_form.html
lang/your language/main.php
[ Installation ]
First Backup your Files.
Donwload the rar archive: Link
Just log in as 4images/4images
Of course you can also create your own account (no email verification is needed, cause its an testboard).
Demo can be also seen there.
Step 1
Open lang/your language/main.php
Before ?> insert
or in German:
For Guestbook Protection follow Step 2 & 3.
For Comment Protection follow Step 4 & 5.
Step 2
Open guestbook.php
Scroll down where you can find
in this section find:
search for:
Step 3
Open templates/guestbook_form.html
search for:
search for:
Step 4
open details.php
search for:
search for:
search for (in 4images v1.71):
search for (in 4images v1.72):
Step 5
open templates/comment_form.html
search for:
search for:
Step 6
unpack the archive and place the images in your /templates/your templates/images/ folder.
done.
Have Phun.
Please give me feedback.
This Mod prevents spamming from Bots in your Guestbook and Commnts,
if you allowed guests to post there.
[ Features ]
This Mod works with an security code,
which must be validated when posting.
The security code is submitted using session system and javascript,
so users which have enabled javascript (which usually most users have),
doesn't notice anything.
users that disabled javascript have to enter the security code manually.
This is an great advantage compared to the captcha solution,
where every user have to enter this code, what is very uncomfortable in my opinion.
You can choose yourself if you use this mod only for guestbook/comments or for both.
[ Notes ]
At the moment the security code is on an very low level,
and not encrypted or anything else,
but it should anyway work.
If somebody gets anyway spam, he/she should contact me,
then i will upgrade this mod.
This mod works with 1.71 & 1.72
other versions are untested.
[ Changed Files ]
for Guestbook:
- guestbook.php
- templates/guestbook_form.html
for comments:
- details.php
- templates/comment_form.html
lang/your language/main.php
[ Installation ]
First Backup your Files.
Donwload the rar archive: Link
Just log in as 4images/4images
Of course you can also create your own account (no email verification is needed, cause its an testboard).
Demo can be also seen there.
Step 1
Open lang/your language/main.php
Before ?> insert
Code: [Select]
//-----------------------------------------------------
//--- Anti Spam Mod -----------------------------------
//-----------------------------------------------------
$lang['enter_secure_code'] = "Please enter Security Code";
$lang['spamcode_error'] = "Security Code Validation failed";
or in German:
Code: [Select]
//-----------------------------------------------------
//--- Anti Spam Mod -----------------------------------
//-----------------------------------------------------
$lang['enter_secure_code'] = "Bitte Sicherheitscode vom Bild eingeben";
$lang['spamcode_error'] = "Sicherheitscode Überprüfung fehlgeschlagen";
For Guestbook Protection follow Step 2 & 3.
For Comment Protection follow Step 4 & 5.
Step 2
Open guestbook.php
Scroll down where you can find
Code: [Select]
//-----------------------------------------------------
//--- Save Comment ------------------------------------
//-----------------------------------------------------
In this part find:Code: [Select]
$comment_mail = un_htmlspecialchars(trim($HTTP_POST_VARS['comment_mail']));
and insert below:Code: [Select]
$prevent_code = (isset($HTTP_POST_VARS['prevent_code'])) ? intval(trim($HTTP_POST_VARS['prevent_code'])) : 0;
in this section find:
Code: [Select]
if (!$error) {
if ($comment_site =="http://") {
insert above:Code: [Select]
/** Anti_Spam Mod **/
if ($site_sess->get_session_var('guestbook_code')) {
$guestbook_code = stripslashes($site_sess->get_session_var('guestbook_code'));
$site_sess->drop_session_var('guestbook_code');
}
else $guestbook_code = 0;
if (!$guestbook_code || $prevent_code != $guestbook_code) {
$msg .= (($msg != "") ? "<br />" : "").$lang['spamcode_error'];
$error = 1;
}
/** Anti_Spam Mod **/
search for:
Code: [Select]
$comment_user_name = (isset($HTTP_POST_VARS['comment_user_name']) && $error) ? stripslashes(htmlspecialchars(trim($HTTP_POST_VARS['comment_user_name']))) : (($user_info['user_level'] != GUEST) ? htmlspecialchars($user_info['user_name']) : "");
$comment_site = (isset($HTTP_POST_VARS['comment_site']) && $error) ? stripslashes(htmlspecialchars(trim($HTTP_POST_VARS['comment_site']))) : "http://";
$site_template->register_vars(array(
"bbcode" => $bbcode,
and replace with:Code: [Select]
$comment_user_name = (isset($HTTP_POST_VARS['comment_user_name']) && $error) ? stripslashes(htmlspecialchars(trim($HTTP_POST_VARS['comment_user_name']))) : (($user_info['user_level'] != GUEST) ? htmlspecialchars($user_info['user_name']) : "");
$comment_site = (isset($HTTP_POST_VARS['comment_site']) && $error) ? stripslashes(htmlspecialchars(trim($HTTP_POST_VARS['comment_site']))) : "http://";
/** Anti_Spam Mod **/
mt_srand((double)microtime() * 1000000);
$prevent_code = mt_rand(10000, 99999);
$site_sess->set_session_var('guestbook_code', addslashes($prevent_code));
$secure_image = '';
for ($i = 0; $i < 5; $i++) {
$secure_image .= '<img src="'.get_gallery_image("captcha".substr($prevent_code,$i,1).".gif").'" border="0" alt="" />';
}
/** Anti_Spam Mod **/
$site_template->register_vars(array(
"lang_enter_secure_code" => $lang['enter_secure_code'],
"secure_image" => $secure_image,
"prevent_code" => $prevent_code,
"bbcode" => $bbcode,
Step 3
Open templates/guestbook_form.html
search for:
Code: [Select]
<tr>
<td width="90" valign="top"> </td>
<td>{bbcode}</td>
</tr>
and insert below:Code: [Select]
<tr>
<td width="90" valign="top"></td>
<td>
<noscript>
<table>
<tr>
<td>{secure_image} </td>
<td><input type="text" name="prevent_code" value="" size="5" /> </td>
</tr>
<tr><td colspan="2"><b>{lang_enter_secure_code}</b></td>
</tr>
</table>
</noscript>
<script type="text/javascript">
function spamcode () {
var spamy = {prevent_code};
document.getElementsByName("prevent_code")[0].value = spamy;
}
document.write('<input type="hidden" name="prevent_code" value="0" \/>');
</script>
</td>
</tr>
search for:
Code: [Select]
<input type="submit" name="postbutton" value="{lang_post_guestbook}" class="button" />
and replace with:Code: [Select]
<input type="submit" name="postbutton" value="{lang_post_guestbook}" onclick="spamcode()" class="button" />
Step 4
open details.php
search for:
Code: [Select]
$comment_text = un_htmlspecialchars(trim($HTTP_POST_VARS['comment_text']));
insert below:Code: [Select]
$prevent_code = (isset($HTTP_POST_VARS['prevent_code'])) ? intval(trim($HTTP_POST_VARS['prevent_code'])) : 0;
search for:
Code: [Select]
if ($user_name == "") {
$msg .= (($msg != "") ? "<br />" : "").$lang['name_required'];
$error = 1;
}
and insert below:Code: [Select]
/** Anti_Spam Mod **/
if ($site_sess->get_session_var('comment_code')) {
$comment_code = stripslashes($site_sess->get_session_var('comment_code'));
$site_sess->drop_session_var('comment_code');
}
else $comment_code = 0;
if (!$comment_code || $prevent_code != $comment_code) {
$msg .= (($msg != "") ? "<br />" : "").$lang['spamcode_error'];
$error = 1;
}
/** Anti_Spam Mod **/
search for (in 4images v1.71):
Code: [Select]
$comment_text = (isset($HTTP_POST_VARS['comment_text']) && $error) ? stripslashes(htmlspecialchars(trim($HTTP_POST_VARS['comment_text']))) : "";
$site_template->register_vars(array(
"bbcode" => $bbcode,
and replace with:Code: [Select]
$comment_text = (isset($HTTP_POST_VARS['comment_text']) && $error) ? stripslashes(htmlspecialchars(trim($HTTP_POST_VARS['comment_text']))) : "";
/** Anti_Spam Mod **/
mt_srand((double)microtime() * 1000000);
$prevent_code = mt_rand(10000, 99999);
$site_sess->set_session_var('comment_code', addslashes($prevent_code));
$secure_image = '';
for ($i = 0; $i < 5; $i++) {
$secure_image .= '<img src="'.get_gallery_image("captcha".substr($prevent_code,$i,1).".gif").'" border="0" alt="" />';
}
/** Anti_Spam Mod **/
$site_template->register_vars(array(
"lang_enter_secure_code" => $lang['enter_secure_code'],
"secure_image" => $secure_image,
"prevent_code" => $prevent_code,
"bbcode" => $bbcode,
search for (in 4images v1.72):
Code: [Select]
$comment_text = (isset($HTTP_POST_VARS['comment_text']) && $error) ? format_text(trim(stripslashes($HTTP_POST_VARS['comment_text'])), 2) : "";
$site_template->register_vars(array(
"bbcode" => $bbcode,
and replace with:Code: [Select]
$comment_text = (isset($HTTP_POST_VARS['comment_text']) && $error) ? format_text(trim(stripslashes($HTTP_POST_VARS['comment_text'])), 2) : "";
/** Anti_Spam Mod **/
mt_srand((double)microtime() * 1000000);
$prevent_code = mt_rand(10000, 99999);
$site_sess->set_session_var('comment_code', addslashes($prevent_code));
$secure_image = '';
for ($i = 0; $i < 5; $i++) {
$secure_image .= '<img src="'.get_gallery_image("captcha".substr($prevent_code,$i,1).".gif").'" border="0" alt="" />';
}
/** Anti_Spam Mod **/
$site_template->register_vars(array(
"lang_enter_secure_code" => $lang['enter_secure_code'],
"secure_image" => $secure_image,
"prevent_code" => $prevent_code,
"bbcode" => $bbcode,
Step 5
open templates/comment_form.html
search for:
Code: [Select]
<td>{bbcode}</td>
</tr>
and insert below:Code: [Select]
<tr>
<td>
<noscript>
<table>
<tr>
<td>{secure_image} </td>
<td><input type="text" name="prevent_code" value="" size="5" /> </td>
</tr>
<tr><td colspan="2"><b>{lang_enter_secure_code}</b></td>
</tr>
</table>
</noscript>
<script type="text/javascript">
function spamcode () {
var spamy = {prevent_code};
document.getElementsByName("prevent_code")[0].value = spamy;
}
document.write('<input type="hidden" name="prevent_code" value="0" \/>');
</script>
</td>
</tr>
search for:
Code: [Select]
input type="submit" name="postbutton" value="{lang_post_comment}" class="button" />
and replace with:Code: [Select]
input type="submit" name="postbutton" value="{lang_post_comment}" class="button" onclick="spamcode()" />
Step 6
unpack the archive and place the images in your /templates/your templates/images/ folder.
done.
Have Phun.
Please give me feedback.