Answered | Installing CAPTCHA - Where to put these two PHP codes?

Forum
Last Post
Threads / Messages

Quillink

Member
Member
Joined
Dec 18, 2008
Messages
93
Points
0
Mysidian Dollar
7,188
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
 
RE: Installing "Securimage CAPTCHA" - need help placing two sections of code (PHP)

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:

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

$securimage = new Securimage();

And

Code:
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
 
RE: Installing CAPTCHA - Where to put these two PHP codes?

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:

PHP:
else{

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

	//First MD5 hash the passwords:

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

Replace With:

PHP:
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:

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

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

	}

Replace With:

PHP:
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. :)
 
RE: Installing CAPTCHA - Where to put these two PHP codes?

Thanks Brandon, it's all working now. :D

I don't know how I missed it before, I forgot to edit the
Code:
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.
 
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???
 
SieghartZeke said:
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 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 said:
IM Italian and some thing I don't know...i have only 14 years,,,

Try looking at this blog post 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).
 

Similar threads

Users who are viewing this thread

  • Forum Contains New Posts
  • Forum Contains No New Posts

Forum statistics

Threads
4,277
Messages
33,122
Members
1,602
Latest member
BerrieMilk
BETA

Latest Threads

Latest Posts

Top