Help with captcha script needed


Posted on 16th Feb 2014 07:03 pm by admin

Hello,

I am working on a script where reCAPTCHA or a similar form of CAPTCHA will be used, for the sake of this example I will talk about reCAPTCHA. I wanted to know how I could have the reCAPTCHA script store a value upon correctly entering a code that will be used by a different script to allow on to proceed?

A snippet of the reCAPTCHA code which will be located in a file called recaptcha.php.

Code: (text) if ($resp->is_valid) {
[b] $captcha = "1";
# in a real application, you should send an email, create an account, etc[/b]
} else {
# set the error code so that we can display it. You could also use
# die ("reCAPTCHA failed"), but using the error message is
# more user friendly
$error = $resp->error;
}
}

I bolded the part of interest, how would I be able to use a variable like

Code: (text) $captcha = "1";
In a completely different file that is called login.php to allow one to login if the captcha is correct? The value would only be needed for that session of course. I want to use this method because the captcha script might be used in multiple locations so I figure this route would be easier and allow for quicker modifications than have the script called each time in different files for instance.

The only alternative I can think of is using MySQL or local files to store the answer but that won't be very logical for a script that could have hundreds of requests an hour.

Any help would be appreciated, thanks in advance

No comments posted yet

Your Answer:

Login to answer
291 Like 21 Dislike
Previous forums Next forums
Other forums

Retreiving objects from Sessions
Hi all,

I am getting really frustrated with storing and retreiving objects from a session. Bu

single page with referrer to show correct page
I have a simple website with a couple of different pages. I would like to be able to in a div tag w

Snapshot from video
anyone knw how to make a snapshot maker from avi n mkv format.
for example if i give a direct lin

PHP Redirecting
Hello everyone. Is there a way to redirect people to pages within a statement in PHP? Since there is

images aren't rendering
I'm trying to call a JPG file from within PHP (in an effort to hide the actual JPG folder). The imag

issues verifying if user is logged in
I am having issues when a user logs in via asp Login control, the IsAuthenticated still seems to com

Multiple includes losing variables
Hey all,

just starting out w php and ran into a problem pretty quickly. I'm
including seve

ALV sum various columns problem
Hi all,
I'm doing a report on ABAP for a timesheet of the current month. The output i want is s

first few characters only
hi, does anyone know how to use PHP to take the first few words of a text and limit them? i have see

Pipe email to PHP - get mail adress from MySQL - send?
Hi all,

this is the challenge:

1) Our faculty at the college where I'm employed includ

Sign up to write
Sign up now if you have flare of writing..
Login   |   Register
Follow Us
Indyaspeak @ Facebook Indyaspeak @ Twitter Indyaspeak @ Pinterest RSS



Play Free Quiz and Win Cash