WebWoW CMS has just released a v2 beta which seems great so far. Of course there are a few small bugs, but nothing that breaks functionality… Mostly undefined indexes and the like. I will probably make a few mods and hacks for the CMS as it’s a great project with a nice style and ethos. This simple modification will place a captcha on the registration page to help prevent spam, bots, and fake registrations.
After about 10 minutes of setting the WebWoW CMS I started to get bot registrations indicated by the spammy usernames and lack of activity. I decided to create a small WebWoW CMS Mod to help prevent the influx of spam. Hopefully this will be of use to someone.
Only two files edits are required so it shouldn’t take more than 5 minutes to implement.
Registration Captcha Mod
Please remember to backup any files before editing!
Open: engine/func/session.php
1a] Find: (about line 324)
function register($subuser, $subpass, $subemail){
Change to:
function register($subuser, $subpass, $subemail, $subcaptcha){
1b] Find: (about line 397)
$subemail = stripslashes($subemail); }
Add below:
/* captcha error checking - nowares */ $field = "captcha"; //Use field name for the generated captcha image if(!$subcaptcha || $subcaptcha != $_SESSION['captcha']){ $form->setError($field, "* captcha incorrect"); } else{ $subcaptcha = mysql_real_escape_string($subcaptcha); }
Open: engine/modules/register.php
2a] Find: (about line 26)
$retval = $user->register($_POST['user_name'], $_POST['pass_word'], $_POST['email']);
Replace with:
$retval = $user->register($_POST['user_name'], $_POST['pass_word'], $_POST['email'], $_POST['captcha']);
2b] Find: (about line 109)
<td><?php echo $form->error("email"); ?></td></tr>
Add below:
<tr> <td>Captcha:</td> <td><img src="captcha/php_captcha.php"> <input name="captcha" type="text" style="width:65px;position:relative;bottom:5px;" value="<?php echo $form->value("captcha"); ?>" /></td> <td><?php echo $form->error("captcha"); ?></td> </tr>
Upload captcha/ folder to your site root
Please note: WebWoW CMS was discontinued and the code is no longer available. This post will remain for archive purposes.
Leave a Reply