HackerOne users: Testing against this community violates our program's Terms of Service and will result in your bounty being denied.

Stop SPAM, changed the captcha

edited August 2011 in Feedback
Hi all, i post method that I've done for stop the spammers (50 per day)

I just changed the captcha, you can see it working on http://www.yomangoteam.com/entry/register

I've used MotionCaptcha project http://www.josscrowcroft.com/projects/motioncaptcha-jquery-plugin/ the only drawback about using this is for users with old navigators, this uses canvas... but i don't care for my forum...


If you want to do this too, download the files of motioncaptcha and place them in your root folder (css,js,png), then change the js file as you need for your language and place this

jquery.motionCaptcha.0.2.js -> line 290:
onSuccess: function($form, $canvas, ctx) { $('#timestamp').val("Yomango"); //Setup any text you want or key but remember it...

Then you have to edit some files:

/aplications/dashboard/models/class.usermodel.php -> Line 844:

// If in Captcha registration mode, check the captcha value if ($_POST['timestamp'] != 'Yomango') { //setup here the word inserted in the js file $this->Validation->AddValidationResult('Garden.Registration.CaptchaPublicKey', 'The CAPTCHA value was not entered correctly. Please try again'); return FALSE; } /* REMEMBER COMMENT THIS PART! // If in Captcha registration mode, check the captcha value if ($CheckCaptcha && Gdn::Config('Garden.Registration.Method') == 'Captcha') { $CaptchaPublicKey = ArrayValue('Garden.Registration.CaptchaPublicKey', $FormPostValues, ''); $CaptchaValid = ValidateCaptcha($CaptchaPublicKey); if ($CaptchaValid !== TRUE) { $this->Validation->AddValidationResult('Garden.Registration.CaptchaPublicKey', 'The reCAPTCHA value was not entered correctly. Please try again.'); return FALSE; } } */

/aplications/dashboard/views/registercaptcha.php -> Line 2:

<link rel="stylesheet" href="/jquery.motionCaptcha.0.2.css"/>

/aplications/dashboard/views/registercaptcha.php -> Line 51:

<li class="CaptchaInput"><?php echo $this->Form->Label("Security Check", ''); //echo recaptcha_get_html($CaptchaPublicKey, NULL, $CaptchaSSL); ?><br /> <div id="mc"> <p>Dibuja con tu raton: (<a onclick="window.location.reload()" href="#" title="Click for a new shape">Otro dibujo</a>)</p> <canvas id="mc-canvas" style="border:1px solid #ccc;"> Your browser doesn't support the canvas element - please visit in a modern browser. </canvas> <input type="hidden" id="mc-action" value="<?=Url('/entry/register')?>" /> <input type="hidden" id="timestamp" name="timestamp" value="<?=date("dmY")?>" /> </div> <script src="/jquery.motionCaptcha.0.2.js" ></script> <script type="text/javascript"> jQuery(document).ready(function($) { // Do the biznizz: $('#Form_User_Register').motionCaptcha({ shapes: ['triangle', 'x', 'rectangle', 'circle', 'check', 'zigzag', 'arrow', 'delete', 'pigtail', 'star'] }); // Yep: $("input.placeholder").placeholder(); }); </script> </li>

and you are done!


  • Options
    Solved the issue with old browsers (non-canvas support) Just added other captcha for them


    This is QatPcha found on: http://www.myjqueryplugins.com/QapTcha

    If you want it working add this to the previously done changes:

    Download the qatpcha files and place them (except jquery.js) on your root folder, and copy the /images folder

    /aplications/dashboard/views/entry/registercaptcha.php -> Line 59:

    <canvas id="mc-canvas" style="border:1px solid #ccc;"> <div id="QapTcha" style="border:1px solid #ccc;"></div> <script type="text/javascript" src="/jquery-ui.js"></script> <script type="text/javascript" src="/jquery.ui.touch.js"></script> <script type="text/javascript" src="/QapTcha.jquery.js"></script> <script type="text/javascript"> $('#QapTcha').QapTcha({}); </script> </canvas>

    Line 2:
    <link rel="stylesheet" href="/QapTcha.jquery.css" type="text/css" />

    /QapTcha.jquery.js -> Line 63:
    /*$.post(opts.PHPfile,{ //REMEMBER COMMET THIS RUBBISH action : 'qaptcha' }, function(data) { if(!data.error) { Slider.draggable('disable').css('cursor','default'); inputQapTcha.val(""); TxtStatus.text(opts.txtUnlock).addClass('dropSuccess').removeClass('dropError'); Icons.css('background-position', '-16px 0'); form.find('input[type=\'submit\']').removeAttr('disabled'); } },'json');*/ Slider.draggable('disable').css('cursor','default'); TxtStatus.text(opts.txtUnlock).addClass('dropSuccess').removeClass('dropError'); Icons.css('background-position', '-16px 0'); $('#timestamp').val("Yomango"); //YOUR SECRET PHARSE
  • Options
    oliverraduneroliverraduner Contributing to Vanilla since 2010 Switzerland ✭✭
    Great input, thanks for this addition @pabloko!
  • Options
    @pabloko help please i install your captcha but in ie8 captcha dont work (Locked : form can't be submited), how me fix this, i need it
Sign In or Register to comment.