PDA

View Full Version : Answered | Installing CAPTCHA - Where to put these two PHP codes?


Quillink
01-24-2010, 09:54 AM
Hey guys,

[Please see next post. You can download my register.php from this one, i fit will help]

Thanks VERY much in advance,
- Quillink

Quillink
01-27-2010, 12:13 AM
Ok I think the prospect of downloading and following a tutorial is chasing people away, so I'll try a different approach:


Can anyone help me with placing these two code extracts in my register.php? It's the validation process for my Securimage CAPTCHA:

include_once $_SERVER['DOCUMENT_ROOT'] . '/securimage/securimage.php';

$securimage = new Securimage();

And

if ($securimage->check($_POST['captcha_code']) == false) {
// the code was incorrect
// handle the error accordingly with your other error checking

// or you can do something really basic like this
die('The code you entered was incorrect. Go back and try again.');
}



Alternatively, does anyone know of a simpler CAPTCHA process? Maybe one you made yourself?

Thanks in advance

BMR777
01-27-2010, 04:45 PM
I would suggest ReCaptcha:

http://recaptcha.net/

Adding that would be super easy.

To use the one you are using though, maybe something like...

Find:

else{

//We are attempting to register the user...

//First MD5 hash the passwords:

$pass1 = md5($pass1);
$pass2 = md5($pass2);


Replace With:

else{

//We are attempting to register the user...

include_once $_SERVER['DOCUMENT_ROOT'] . '/securimage/securimage.php';

$securimage = new Securimage();

//First MD5 hash the passwords:

$pass1 = md5($pass1);
$pass2 = md5($pass2);

Find:

else if($tos != "yes"){

//User did not agree to TOS
$article_title = "Terms of Service Error";
$article_content = $notos;

}

Replace With:

else if($tos != "yes"){

//User did not agree to TOS
$article_title = "Terms of Service Error";
$article_content = $notos;

}
else if($securimage->check($_POST['captcha_code']) == false){

// The captcha is wrong, put your message here...

$article_title = "Captcha Incorrect";
$article_content = "Captcha Incorrect";

}

Try that and see if it works. :)

Quillink
01-27-2010, 11:24 PM
Thanks Brandon, it's all working now. :D

I don't know how I missed it before, I forgot to edit the
include_once $_SERVER['DOCUMENT_ROOT'] . '/securimage/securimage.php';
to point to where I put the file. It wasn't working because it's in another directory..!

Always one sentence of code that'll cost you hours, isn't it lol?


Thanks again.

SieghartZeke
01-28-2010, 02:02 AM
Ehm wait a moment...i don't know where you can download ReCaptcha!
Im registrated, added my site to the list...but...WHERE IS THE DOWNLOAD LINK???

Tequila
01-28-2010, 08:56 AM
Ehm wait a moment...i don't know where you can download ReCaptcha!
Im registrated, added my site to the list...but...WHERE IS THE DOWNLOAD LINK???


All the information is available on the Resources (http://recaptcha.net/resources.html) page.
There are three ways to use reCAPTCHA: with an application plugin, with a library for your programming language, or with the web-based API. The following resources will help you find the correct method to add our CAPTCHA in your environment.

I'll try installing later on, still have cleaning to do.

SieghartZeke
01-28-2010, 09:26 AM
And what of this i need to choose??

Seapyramid
01-29-2010, 01:22 AM
Try reading & learning.. the info is there if you want it.

SieghartZeke
01-29-2010, 03:46 AM
IM Italian and some thing I don't know...i have only 14 years,,,

Tequila
01-29-2010, 07:26 AM
IM Italian and some thing I don't know...i have only 14 years,,,


Try looking at this blog post (http://inko9nito.wordpress.com/2007/12/12/installing-recaptcha-with-php/) on how to use it with PHP (which is what I'm doing first). I wish I could recommend a good free translation service, but none of them convey correctly (take it from an artist who has to send Cease and Desist letters to people outside of the English speaking community).