Rusnak PHP Scripts Support Forums

Full Version: Adding a simple CAPTCHA to the order form.
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2
I saw that somebody already posted a tutorial for this, but I figured I'd post my way anyways since I find it a bit more simple and easier to read than most CAPTCHAs (then again I am partially colorblind so this is for those out there like me who dislike CAPTCHAs with lots of colors).

I've attached the captcha_image.php file that I use, it was not created by me so all copyrights in the file must remain intact.

Somewhere in your sign-up form add the following (index.php):
Code:
<img src="captcha_image.php">: <input name="captcha" id='captcha'>

Find in mkforum.php:
Code:
<?php
//Brandon's MyBB Multiforum Installer File
//http://www.webringamerica.com
//brusnak@webringamerica.com :: brusnak@rusnakweb.com
//Designed for WebringAmerica - Free Forum Hosting, No Forced Ads

// ********************************************************************************​***

Add below:
Code:
session_start();
if ($_POST["captcha"] != $_SESSION["pass"])
{
die('CAPTCHA Failed, press the Back button on your browser and try again.');
}

Done! Smile

Demo: http://www.talk2x.com/index.php
Nice! Thanks for sharing. Smile
Nice, I added it to my forum creation page ! I will share my link ultil I finish designing my website.

Thanks!
I have problem
when I type good chapta i have error :
CAPTCHA Failed, press the Back button on your browser and try again.
Do you have cookies enabled? Can you copy and paste your form and your mkforum.php page so I can view the code? Thanks.
I have to tell you that for me is this:
public_html: index.php (to make a forum)
public_html : captcha_image.php
public_html / forum / create / mkforum.php

index.php :
Code:
<form action='http://www.mybbhost.pl/forum/create/mkforum.php' method='post' name='mform' id='mform'>
         <span class='style6'><u><b> Adres twojego forum :</b></u></span> <span class='style9'></span><span class='style3'><br />
              <br />
              http://</span>          
              <input name='fname' type='text' id='fname' maxlength='20' /><span class='style3'>.mybbhost.pl</span>
              <span class='style10'>&nbsp;&nbsp;<br>Adres ten może mieć od 6 do 20 znaków.</span> </p>

          <span class='style6'><u><br /><br /><b>Twój adres e-mail:</b></u></span><br>
              <br />          
              <input name='email' type='text' id='email' />
&nbsp;&nbsp;<span class='style10'><br />Musi być prawdziwy, ponieważ na niego przyjdzie kod aktywacyjny.</span></p>
        <span class='style6'><u><br /><br /><b>Nazwa administratora forum:</b></u></span><br>
              <br />          
              <input name='uname' type='text' id='uname' /></p>
        <span class='style6'><u><br /><br /><b>HasÅ‚o administratora forum:</b></u></span><br>

              <br />          
              <input name='pass1' type='password' id='pass1' />
          &nbsp;&nbsp;<span class='style10'><br />Musi mieć min. 6 znaków, dozwolone sÄ… tylko litery i cyfry.</span>
        <span class='style6'><u><br /><br /><b>Potwierdź hasÅ‚o administratora:</b></u></span><br />
              <br />          
              <input name='pass2' type='password' id='pass2' /></p>
       <span class='style6'><u><br /><br /><b>Nazwa forum:</b></u></span><br />
              <br />      
              <input name='forumname' type='text' id='forumname' />&nbsp;&nbsp;<span class='style10'><br />Nazwa ta bÄ™dzie wyÅ›wietlana na każdej stronie twojego forum.</span></p>

            <input name='language' type='hidden' value='' />    
            <img src="captcha_image.php">: <input name="captcha" id='captcha'>
        
              <br /><br /><input name='submit' type='submit' id='submit' value='Załóż darmowe forum !' />
          
      </form>
I give only a part index.php

and mkforum.php :
Code:
<?php
//Brandon's MyBB Multiforum Installer File
//http://www.webringamerica.com
//brusnak@webringamerica.com :: brusnak@rusnakweb.com
//Designed for WebringAmerica - Free Forum Hosting, No Forced Ads

// ********************************************************************************​***
session_start();
if ($_POST["captcha"] != $_SESSION["pass"])
{
die('CAPTCHA Failed, press the Back button on your browser and try again.');
}

//Include the database config file
include 'mconfig.php';
//Include the files for MyBB 1.4 passwords
include '../inc/functions_user.php';
include '../inc/functions.php';


//Deal with the language settings
$lang = $_POST['language'];
$lang = preg_replace("/[^a-zA-Z0-9s]/", "", $lang);

if($lang != "english" or $lang !=""){

I give only a part mkforum.php
I wait for reply
I've looked over the code and can't find why it doesn't work. Sorry, I wish I could spend more time troubleshooting. Sad
I have a problem:

Code:
Parse error: syntax error, unexpected T_STRING, expecting ',' or ';' in /home3/okba/public_html/mybb/create/create.php on line 106

In line 106 i have this:
Code:
<img src="captcha_image.php">: <input name="captcha" id='captcha'>

thank's
no one?
thks
Pages: 1 2
Reference URL's